How to detect programmatically when a user enables a widget in Today View
I have an app with a widget, that the user can enable or disable in the iphone's Today View. Is there a way to detect programmatically when a user enables an app extension (widget)? I'd like to count users who install the widget, so i have to catch the exact moment when the user click "enable" in my app (it would be useful catch "disable" action too). Any ideas? Thanks!
Thank for ask the question.
When user allow to widget to show in notification center, then your widget life cycle method getting call.
Here you need to manage by flag some as below For example
If widget launch first time and upload count to server successfully then your NSUserDefault
set to YES
else Set it to NO
If your app is not launch first time then do the regular process then no need to upload in server
链接地址: http://www.djcxy.com/p/50590.html上一篇: 如何禁用Android上的方向更改?