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

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

iphone crifan 9578浏览 0评论
//            let appId = "944848654" //网易云音乐
            let appId = "491854842" //有道词典
//            let appId = "839686104" //X-Gift
//            let urlPrex = "itms-apps"
            let urlPrex = "https"
            let appUrl = NSURL(string: urlPrex + "://itunes.apple.com/app/id" + appId)
            UIApplication.sharedApplication().openURL(appUrl!)

效果:

//            let appId = "944848654" //网易云音乐
//            let appId = "491854842" //有道词典
            let appId = "839686104" //X-Gift
//            let urlPrex = "itms-apps"
//            let urlPrex = "https"
            let urlPrex = "http"
            let appUrl = NSURL(string: urlPrex + "://itunes.apple.com/app/id" + appId)
            UIApplication.sharedApplication().openURL(appUrl!)

还是不行:

又去试了试:

itms

itms-apps

结果都不行。

//            let appId = "944848654" //网易云音乐
//            let appId = "491854842" //有道词典
            let appId = "839686104" //X-Gift
//            let urlPrex = "itms-apps"
            let urlPrex = "itms"
//            let urlPrex = "https"
//            let urlPrex = "http"
            var appUrl = urlPrex + "://itunes.apple.com/app/id" + appId
           
            appUrl = "https://itunes.apple.com/cn/app/you-dao-ci-dian/id491854842?mt=12"

            print("appUrl=\(appUrl)")
            let appNsUrl = NSURL(string: appUrl)

            UIApplication.sharedApplication().openURL(appNsUrl!)

竟然还不行。。。

//            let appId = "944848654" //网易云音乐
//            let appId = "491854842" //有道词典
            let appId = "839686104" //X-Gift
//            let urlPrex = "itms-apps"
            let urlPrex = "itms"
//            let urlPrex = "https"
//            let urlPrex = "http"
            var appUrl = urlPrex + "://itunes.apple.com/app/id" + appId
           
            appUrl = "https://itunes.apple.com/cn/app/you-dao-ci-dian/id491854842?mt=12"

            appUrl = "http://www.baidu.com"
            appUrl = "https://itunes.apple.com/cn/app/wechat/id836500024?mt=12"
           
            print("appUrl=\(appUrl)")
            let appNsUrl = NSURL(string: appUrl)

            UIApplication.sharedApplication().openURL(appNsUrl!)

结果还是出错:

试了试打开百度:

倒是可以打开的。

但是其他网址,比如:

https://itunes.apple.com/cn/app/wechat/id836500024?mt=12

很多在电脑上都是可以正常打开,但是iPhone内就打不开。

iphone Safari打不开网页,因为网址无效

iOS9.21 Safari经常提示打不开网页 因为网址无效? – 苹果公司 (Apple Inc.) – 知乎

苹果手机“safari打不开网页,因为网址无效”是什么意思?_大智慧下载-xingten.com

为什么会显示safari打不开该网页,因为网址无效 – 搜搜问问

safari打不开该网页,因为网址无效。只在浏览百度贴吧时发生,浏览别的网页正常。 | Apple 支持社区

难道是因为:

用的是iOS模拟器的原因?

去换用真机iPhone 6去试试

然后上述的地址:

https://itunes.apple.com/cn/app/wechat/id836500024?mt=12

iPhone6真机上,是可以正常监测打开的:

-》所以需要去换一个,iOS内的app,再去尝试去打开。

转载请注明:在路上 » [已解决]iPhone中app内打开有效的http网址出错:Safari打不开网页,因为网址无效

发表我的评论
取消评论

表情

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

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.180 seconds, using 22.05MB memory