iOS 应用跳转: 跳转到设置,短信,QQ,微信,微博
2016-08-19 本文已影响0人
Sparkle_S
根据应用程序描述链接,我们便可以跳转到相应的应用
//跳转到应用的设置界面
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~