How to detect user returned to your app in iOS 9 new back link feature?

断了今生、忘了曾经 提交于 2019-12-07 07:00:30

问题


Have an application which links to the settings app through:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

In iOS 9, there is now a way for the user to return to the app again by one back link on the top left of the screen.

Does anybody know how my app can detect that the user came back again? I need to reload the tableview and the viewWillAppear function does not get executed unfortunately...


回答1:


I found it out, just listen to the following notification:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enteredForeground) name:UIApplicationWillEnterForegroundNotification object:nil];

;-)




回答2:


You can also add in the method

-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options

To know if they pressed the backlink into your app



来源:https://stackoverflow.com/questions/32665855/how-to-detect-user-returned-to-your-app-in-ios-9-new-back-link-feature

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