I’m having a really strange issue with the Pasteboard, and I’m looking for suggestions:
When switching into my app to paste some text, the text in the pasteboard sometimes gets cleared, so when I try to paste there is nothing in the pasteboard anymore. Switching and pasting in other apps are fine, so something is unique about my app.
heres a video of the problem (simulator) and the weird work around i’ve found.
http://screencast.com/t/ID57TikvFOD
Example: if i am in mail, copy some text, and then double tap home and switch to my running app, the paste option almost never appears. When i go to my input box and press-and-hold, the Paste button never appears.
Oddly, this behavior is not consistent as it sometimes works. I’d guess about 20% of the time it works and 80% of the time the pasteboard is cleared. I thought it might be a memory warning clearing the pasteboard, so I watched my iPad with “activity monitor” in instruments and I dont see any memory warnings.
This is driving me nuts. I can repro the same inconsistency in my iOS 5 ipad, as well as 4.2 and 5.0 simulators. My customer is running 4.2 and the work-around i’ve found (double switching) doesn’t work for him.
In my code, the only time i ever reference the pasteboard i’m just putting things in it. i never clear it.
- (IBAction)copyToClipboard:(id)sender {
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = currentCard.concept.chineseWord;
[self._delegate dismissPopover];
}
Any idea what might be going wrong?
AndreasZ’s tip solved the problem for me. Flurry was buggy and was causing the pasteboard issue.