Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy text to clipboard through safari and read that clipboard data in iOS App

Facing problem with the following scenario. Before posting in stack overflow, I spent several hours behind this. Scenario

Step 1: Via Safari (or other any browser) User will browse a page (i.e. www.abcdef.com) and from that page safari will copy text to iOS clipboard (via user on touch event on copy button)

Step 2: iOS Application will be launched and that iOS application will get/read clipboard data (which was saved/written by safari).

Is it possible? and if how? If not possible can you share reason behind that?

like image 902
Md Mahbubur Rahman Avatar asked Nov 16 '16 16:11

Md Mahbubur Rahman


1 Answers

Yes you can do this,here is an example of that

UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
if (pasteboard.string != nil) {
    // Do something with the contents...
}
like image 152
Rajat Avatar answered Nov 11 '22 16:11

Rajat