切换到我的应用程序会导致粘贴板清除。 iPad 粘贴按钮有时不会出现
我在粘贴板方面遇到了一个非常奇怪的问题,我正在寻找建议:
当切换到我的应用程序以粘贴一些文本时,粘贴板中的文本有时会被清除,因此当我尝试粘贴时,粘贴板中没有任何内容不再是纸板了。在其他应用程序中切换和粘贴都很好,所以我的应用程序有一些独特之处。
这是问题(模拟器)的视频以及我发现的奇怪的解决方法。 http://screencast.com/t/ID57TikvFOD
示例:如果我在邮件中,请复制一些文本,然后双击主页并切换到我正在运行的应用程序,粘贴选项几乎从未出现。当我转到输入框并按住时,“粘贴”按钮永远不会出现。 奇怪的是,这种行为并不一致,因为它有时有效。我猜大约 20% 的时间它可以工作,80% 的时间粘贴板被清除。我认为这可能是内存警告清除粘贴板,所以我用仪器中的“活动监视器”查看了我的 iPad,但没有看到任何内存警告。
这让我抓狂。我可以在我的 iOS 5 ipad 以及 4.2 和 5.0 模拟器中重现同样的不一致情况。我的客户正在运行 4.2,我发现的解决方法(双切换)对他不起作用。
在我的代码中,我唯一一次引用粘贴板时,我只是将东西放入其中。我从来没有清除过它。
- (IBAction)copyToClipboard:(id)sender {
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = currentCard.concept.chineseWord;
[self._delegate dismissPopover];
知道
可能出了什么问题吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AndreasZ 的建议解决了我的问题。 Flurry 存在问题并导致了粘贴板问题。
AndreasZ's tip solved the problem for me. Flurry was buggy and was causing the pasteboard issue.