I'm trying to put some plain text in the iPhone Pasteboard. The following code doesn't seem to work:
UIPasteboard *pboard = [UIPasteboard generalPasteboard];
NSString *value = @"test";
[pboard setValue: value forPasteboardType: @"public.plain-text"];
I'm guessing the problem is in the PasteBoard type argument. Passing @"public.plain-text"
nothing happens. Passing kUTTypePlainText
the compiler complains about incompatible pointer type, but doesn't crash, and nothing happens either. Using kUTTypePlainText
also seems to require linking with MobileCoreServices
, which is not mentioned in the docs.
Use this header to get the value for kUTTypeUTF8PlainText;
#import <MobileCoreServices/UTCoreTypes.h>
You'll need to have the MobileCoreServices framework available.