I am trying to write a code with objective-C in Xcode to read a text from clipboard and print it to console I have some trouble. with that. I would appreciate if you can help me to write this code.
Thank you
I am trying to write a code with objective-C in Xcode to read a text from clipboard and print it to console I have some trouble. with that. I would appreciate if you can help me to write this code.
Thank you
You should use UIPasteboard
class from UIKit
framework.
Apple doc says
The UIPasteboard class provides pasteboards: protected areas for sharing data within an app or between apps. The class offers methods for writing and reading items of data to and from a pasteboard.
for further reference apple doc link 1, link 2
add this method in your viewcontroller and call it.
-(void)printClipboardContent{
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
NSString *string = pasteboard.string;
Nslog (@"clipboard text :%@",string);
}