When using the code
[[UIPasteboard generalPasteboard] setString:@"mung"];
NSLog(@"%@", [UIPasteboard generalPasteboard].string);
开发者_Go百科
the console reports the new value of the string, but typing command-V in another application shows the previous pasteboard contents (which may be nothing).
Is there a reliable way to save a single string for use in another application?
Please advise. Thank you.
The simulator's UIPasteboard (accessed via the menu controller, processed by pasteboardd
) is independent from the host's NSPasteboard (accessed via Cmd+C/V, processed by /usr/sbin/pboard
).
精彩评论