나는 동일한 문제가있었습니다. (강조 광산 임) changeCount
속성의 UIPasteboard Class Reference 문서에 따르면
마다이 속성의 판지 변경-특히 판지 항목을 추가, 수정 또는시 제거-UIPasteboard가 증가 값의 내용. 변경 카운트가 증가하면 UIPasteboard는 UIPasteboardChangedNotification (추가 및 수정의 경우) 및 UIPasteboardRemovedNotification (제거의 경우)이라는 알림을 게시합니다. ... 클래스는 또한 응용 프로그램이 다시 활성화되고 다른 응용 프로그램이 대지 내용을 변경하면 변경 횟수 을 업데이트합니다. 사용자가 장치를 다시 시작하면 변경 횟수가 0으로 재설정됩니다.
이 내용은 앱이 다시 활성화되면 내 애플리케이션이 UIPasteboardChangedNotification
알림을 수신한다는 의미입니다. 그러나주의 깊게 읽으면 앱이 다시 활성화 될 때 업데이트되는 것은 changeCount
뿐입니다.
응용 프로그램이 배경에있는 동안 changeCount
이 변경된 것을 발견하면 내 응용 프로그램 대리인의 페이스트 보드 changeCount
을 추적하고 예상 알림을 게시하여 처리했습니다. 응용 프로그램 위임의 인터페이스에서
:
NSUInteger pasteboardChangeCount_;
앱 위임의 구현
: 당신은 지금이
- (BOOL)application:(UIApplication*)application
didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(pasteboardChangedNotification:)
name:UIPasteboardChangedNotification
object:[UIPasteboard generalPasteboard]];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(pasteboardChangedNotification:)
name:UIPasteboardRemovedNotification
object:[UIPasteboard generalPasteboard]];
...
}
- (void)pasteboardChangedNotification:(NSNotification*)notification {
pasteboardChangeCount_ = [UIPasteboard generalPasteboard].changeCount;
}
- (void)applicationDidBecomeActive:(UIApplication*)application {
if (pasteboardChangeCount_ != [UIPasteboard generalPasteboard].changeCount) {
[[NSNotificationCenter defaultCenter]
postNotificationName:UIPasteboardChangedNotification
object:[UIPasteboard generalPasteboard]];
}
}
를 해결나요? 나는 또한 이것을 성취하려고 노력하고있다. http://cl.ly/69a4 답을 찾았 으면 나와 공유해 주시겠습니까? – Frankrockz