iOS8 Today Extension: Detect removed or added today extension

£可爱£侵袭症+ 提交于 2019-12-11 07:42:45

问题


I would like to know how to detect when user removes or adds today extension. If Apple does not have any method to do that, please suggest some ways for me to detect it.

Thank you very much for your time to answer my question.


回答1:


You cannot detect when the user adds or removes a today extension. You can detect when an extension is run for the first time by reading/writing a value to NSUserDefaults, but that's about it.




回答2:


If you don't need 100% accuracy, you could post [UIDevice currentDevice].identifierForVendor.UUIDString to an external API every time the widget is loaded. This would give you a time record of every time the user looked at your widget (while connected to the Internet). If you stop receiving regular updates from one UUID:

  • The user disabled your widget
  • The user removed your app
  • The user reset their vendor identifier

As I said, it won't be 100% accurate. That's about as close as you can get.



来源:https://stackoverflow.com/questions/26622393/ios8-today-extension-detect-removed-or-added-today-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!