问题
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