根據應用程序描述鏈接,我們便可以跳轉到相應的應用
//跳轉到應用的設置界面
let setUrl = NSURL(string:UIApplicationOpenSettingsURLString)
if UIApplication.sharedApplication().canOpenURL(setUrl!) {
UIApplication.sharedApplication().openURL(setUrl!)
}else{
let alertCtrl = UIAlertController.init(title: "跳轉到設置失敗", message: "您可以點擊重試", preferredStyle: .Alert)
let goAction = UIAlertAction.init(title: "好的", style: .Default, handler: { (action) in
self.jumpToOtherApp(NSNull)
})
let cancleAction = UIAlertAction.init(title: "取消", style: .Cancel, handler: nil)
alertCtrl.addAction(cancleAction)
alertCtrl.addAction(goAction)
self.presentViewController(alertCtrl, animated: true, completion: nil)
}
應用程序描述鏈接:
設置: UIApplicationOpenSettingsURLString
短信: "sms://"
QQ: "mqqapi://"
微信: "wechat://"
微博: "sinaweibo://"
期待你的評論建議O(∩_∩)O~