有没有办法做到这一点?我UIPasteboardChangedNotification
在发布时注册了我的对象,但是当它发送到后台并打开(例如)Safari并复制一些文本时,我的处理程序永远不会被调用.(我现在只使用模拟器).
我用过两个:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(pasteboardNotificationReceived:)
name:UIPasteboardChangedNotification
object:[UIPasteboard generalPasteboard]];
Run Code Online (Sandbox Code Playgroud)
和:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(pasteboardNotificationReceived:)
name:UIPasteboardChangedNotification
object:nil ];
Run Code Online (Sandbox Code Playgroud)
注册我的处理程序.