我想觀察日曆應用程序的更改,因此我註冊了EKEventStoreChangedNotification
通知。但是,我是否需要讓一個EKEventStore
對象「活着」才能收到此通知?我想我正在初始化視圖控制器中的EKEventStore
對象以檢索一些事件。然後我將彈出導航堆棧的這個視圖控制器,視圖控制器將被釋放,因此EKEventStore
對象將被釋放。iOS - Event Kit編程監聽通知
2
A
回答
2
不,你不需要保持EKEventStore對象活着,你正在使用名爲eventStore
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(storeChanged:)
name:EKEventStoreChangedNotification object:eventStore];
參考this您的疑問
0
的多個間隙對於EKEventStore對象EKEventStoreChangedNotification已註冊swift 3.x,像下面一樣使用
NotificationCenter.default.addObserver(self, selector: #selector(ViewController.storeChanged(_:)), name: NSNotification.Name.EKEventStoreChanged, object: eventStore)
...
...
...
//Method
func storeChanged(_ nsNotification: NSNotification) {
//do your stuff
}
相關問題
- 1. NS通知監聽器iOS
- 2. 線程監聽器通知
- 3. iOS推送通知監聽器?
- 4. NS通知監聽
- 5. JMX通知監聽
- 6. jQuery Event Listener不在監聽
- 7. 如何設置JMX通知監聽器?
- 8. sw-precache推送通知監聽器
- 9. NSDistributedNotificationCenter監聽未公開的Apple通知
- 10. 應用程序監聽器沒有收到事件通知
- 11. 以編程方式在IOS中設置動作監聽程序
- 12. 監測通知
- 13. iPhone 4.0 - 文件監視器/監聽器通知?
- 14. 我們可以以編程方式在通知監聽器服務的通知上執行ACTION嗎?
- 15. Laravel通知事件監聽器未定義的屬性
- 16. 編程麻煩動作監聽器?
- 17. Laravel監聽器監聽多個事件
- 18. 保持進程監聽互通
- 19. iPhone上的蘋果推送通知監聽端口
- 20. 遠程通知Ios
- 21. 聽iphone通知?
- 22. 鈦android推送通知回調監聽器
- 23. iPhone Event Kit - 活動自定義字段
- 24. 監聽UDP和監聽
- 25. ios-聽其他應用程序的鍵盤通知
- 26. 片段通信監聽器
- 27. Postgresql 9.3監聽通道
- 28. 通訊簿監聽器
- 29. 聽鍵盤按通知
- 30. 如何讓Yammer Embed Feed Event監聽器正常工作?
[@Peter Warbo](http://stackoverflow.com/users rs/294661/peter-warbo)是你的疑問清除..? –