最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]swift应用内跳转到AppStore

Swift crifan 5483浏览 0评论

swift实现,app内,跳转到AppStore中的某个app的页面

以便于实现app的更新

swift jump to app store

app store – Open appStore through button in app – SWIFT – Stack Overflow

ios – Launching App Store from App in Swift – Stack Overflow

试了试别人的一个app store的地址:

itms-apps://itunes.apple.com/app/bars/id706081574

用safari打开:

结果app store没有打开,没有反应。

itms://itunes.apple.com/de/app/x-gift/id839686104?mt=8&uo=4

可以直接调用iTunes打开:

去appStore中找个app,然后拷贝出其链接地址

https://itunes.apple.com/cn/app/wang-yi-yun-yin-le/id944848654?mt=12

然后用浏览器打开试试

然后再去找到App Store中的地址:

https://itunes.apple.com/cn/app/wang-yi-yun-yin-le/id944848654?mt=12#

结果好像只是内部的js跳转?

结果找了半天没有找到

itms开头的url地址

搜:

app store itms

iphone – iOS URI link to an app in App Store (itms-apps) – Stack Overflow

itms-apps://itunes.apple.com/app/id

那么去试试:

itms-apps://itunes.apple.com/app/id944848654

itms://itunes.apple.com/app/id944848654

Technical Q&A QA1633: Creating easy-to-read short links to the App Store for your apps and company

Technical Q&A QA1629: Launching the App Store from an iOS application

App Store:itms-apps | handleOpenURL, Shared Interapp Communication on iOS

itms-apps://itunes.apple.com/us/app/pages/id361309726?mt=8&uo=4

iTunes Link Maker

“Create links for Apple Music, the iTunes Store, the App Store, the iBooks Store, and the Mac App Store.”

[已解决]iPhone中app内打开有效的http网址出错:Safari打不开网页,因为网址无效

然后换用iPhone真机:

去试试itms-apps:

itms-apps://itunes.apple.com/app/id839686104

是可以打开的:

并且,可以点击屏幕左上角的:

返回xxx

返回原先自己的app:

[总结]

对于一个app来说,

  • 跳转到iTunes,用:
    • itms://itunes.apple.com/app/idYOUR_APP_ID
    • (iTunes内部会调用AppStore的功能模块去打开应用的页面的)
  • 跳转到AppStore,用:
    • itms-apps://itunes.apple.com/app/idYOUR_APP_ID
  • 而如果想要浏览器以网页打开,则是http的地址:

比如网易云音乐,id是:944848654

分别是:

此处,想要iOS的app内部调用AppStore打开app的话,则推荐使用:

itms-apps://itunes.apple.com/app/idYOUR_APP_ID

代码为:

//            let appId = "944848654" //网易云音乐 Mac, Note: Mac version app can not opened in iOS (by App Store)
            let appId = "590338362" //网易云音乐 iOS
//            let appId = "839686104" //X-Gift
            let urlPrex = "itms-apps" //direct call App Store to open
//            let urlPrex = "itms" // call iTunes to open
//            let urlPrex = "https" //call Web browser (Safari) to open
//            let urlPrex = "http" //call Web browser (Safari) to open
            let appUrl = urlPrex + "://itunes.apple.com/app/id" + appId
            print("appUrl=\(appUrl)")
            let appNsUrl = NSURL(string: appUrl)
            //itms-apps://itunes.apple.com/app/id839686104
            //itms-apps://itunes.apple.com/app/id590338362
            UIApplication.sharedApplication().openURL(appNsUrl!)

注意:

如果是Mac中打开的app,得到的ID,比如网易云音乐的944848654,去iOS中打开:

itms-apps://itunes.apple.com/app/id944848654

则会提示不支持:

然后通过iOS中AppStore打开的app,,拷贝出来的链接,则是短链接:

网易云音乐-《我是歌手4》正版海量曲库免费下载播放 作者是 NetEase (Hangzhou) Network Co., Ltd.

跳转到:

网易云音乐-《我是歌手4》正版海量曲库免费下载播放 on the App Store

-》对应的iOS的app id则是590338362

-》即:

对于同一款app

Mac中的app的id

iOS中的app的id

是不一样的:

网易云音乐

Mac:944848654

iOS:590338362

然后iOS端才能打开:

转载请注明:在路上 » [已解决]swift应用内跳转到AppStore

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
91 queries in 0.202 seconds, using 22.10MB memory