I was debugging a defect which occurs, when clipboard is empty (could see popup triangle without popup, possibly system defect). As part of examining the defect I copied something on clipboard and now would need to clear it... but how?
Shutting down simulator and restarting did not clear clipboard. Have to say it's pretty funny not to be abl开发者_开发问答e to do such a "simple" task :)
Before anyone suggests, copying space or some other whitespace character will not be enough. I need it to be empty, not just non-visible.
You can reset the simulator to "factory defaults".
Click on "iOS Simulator" in the menu bar and select the third option from the top.
This is similar to copying whitespace, but more effective (and less destructive than The-Kenny's solution). You can paste an empty string to the clipboard, something like:
[pasteboard setString:@""];
Once your program runs this line of code, the "Paste" option will no longer appear in the pop up triangle menu. I have been using this exact method while testing my code, and it works great. Good Luck.
The best solution is to simply set the text, image or whatever, to NULL before the code that you need to fix. This clears the pasteboard completely.
精彩评论