I have a UIWebView
showing some custom HTML content. If I tap and hold, then select some text and tap the Copy
option, the text gets added to UIPasteboard
with the key "com.apple.rtfd". My problem now is that I can't find any way of extracting the actual textual contents of what I just copied. If I use this code:
NSString *contents = [NSString stringWithUTF8String:[data bytes]];
it returns the literal string "rtfd", regardless of what text I actually copied from the UIWebView
. If I use this code:
NSString *contents = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
I get a blank string. How can I get the actual text contents of what I just copied into the pasteboard?