本文介绍了openURL 回调?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
限时送ChatGPT账号..用户拒绝定位,我将用户发送到设置"应用上的定位设置:
User refuses location, I send user to Location settings on Settings app:
UIApplication.sharedApplication().openURL(NSURL(string:"prefs:root=LOCATION_SERVICES")!)
用户从设置"应用授权位置,返回到我的应用,左上角带有 返回应用
User authorizes location from Settings app, returns to my app with Back to App
on top left
我怎么知道他回到了应用程序?viewDidAppear
不起作用
How do I know that he came back to the app? viewDidAppear
doesn't work
推荐答案
您可以通过检查AppDelegate的
方法轻松检测:-
You can easily detect by checking AppDelegate's
method:-
func applicationWillEnterForeground(application: UIApplication!) {
或者通过NSNotificationCenter
在你的视图控制器的viewDidLoad()中注册一个通知:-
Or by registering a notification in your view controller's viewDidLoad() by NSNotificationCenter
:-
NSNotificationCenter.defaultCenter().addObserver(self, selector: "applicationWillEnterForeground", name: UIApplicationWillEnterForegroundNotification, object: nil)
//calling selector method
func applicationWillEnterForeground() {
println("did enter foreground")
}
这篇关于openURL 回调?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论