Launch an app from within another (iPhone)

后端 未结 14 1961
没有蜡笔的小新
没有蜡笔的小新 2020-11-22 01:14

Is it possible to launch any arbitrary iPhone application from within another app?, For example in my application if I want the user to push a button an

14条回答
  •  猫巷女王i
    2020-11-22 01:15

    In Swift

    Just in case someone was looking for a quick Swift copy and paste.

    if let url = NSURL(string: "app://") where UIApplication.sharedApplication().canOpenURL(url) {
                UIApplication.sharedApplication().openURL(url)
    } else if let itunesUrl = NSURL(string: "https://itunes.apple.com/itunes-link-to-app") where UIApplication.sharedApplication().canOpenURL(itunesUrl) {
                UIApplication.sharedApplication().openURL(itunesUrl)      
    }
    

提交回复
热议问题