iOS 【AppStore 上架时由于 ipv6 原因被拒】

来源:互联网 发布:mysql重置初始密码 编辑:程序博客网 时间:2024/05/18 01:58

现如今由于 IPv4 最大的问题在于网络地址资源有限,严重制约了互联网的应用和发展。IPv6 的使用,不仅能解决网络地址资源数量的问题,而且也解决了多种接入设备连入互联网的障碍。所以说 apple 也强制要求我们的 App 需要支持 IPv6 互联网协议。

看到朋友发给我的一处被拒的信息报告:

被拒信息: Guideline 2.1 - Performance - App CompletenessWe discovered one or more bugs in your app when reviewed on iPhone and iPad running iOS 10.3.2 on Wi-Fi connected to an IPv6 network.Specifically, your app displays an activity indicator indefinitely for a few seconds when we attempt to login with the demo account but we were unable to advance past the login page.Please see attached screenshots for details.Next StepsTo resolve this issue, please run your app on a device while connected to an IPv6 network (all apps must support IPv6) to identify any issues, then revise and resubmit your app for review.If we misunderstood the intended behavior of your app, please reply to this message in Resolution Center to provide information on how these features were intended to work.For new apps, uninstall all previous versions of your app from a device, then install and follow the steps to reproduce the issue. ResourcesFor information about supporting IPv6 Networks, please review Supporting IPv6 DNS64/NAT64 Networks and About Networking.

这是苹果反馈给我们的拒绝信息,具体表述为 要解决此问题,请在连接到IPv6网络(所有应用必须支持IPv6)的设备上运行您的应用程序以识别任何问题,然后修改并重新提交应用程序以供审核。


然后 apple 建议我们查看文档进行解决,于是我查看了官方文档 Supporting IPv6 DNS64/NAT64 Networks

请读者注意下图中标注的文字:


"If you’re writing a client-side app using high-level networking APIs such as NSURLSession and the CFNetwork frameworks and you connect by name, you should not need to change anything for your app to work with IPv6 addresses. "

可以译为:

"如果您正在使用高级网络API(如NSURLSession和CFNetwork框架)编写客户端应用程序,并且按名称进行连接,则不需要为应用程序更改任何内容以使用IPv6地址。"

也就是说,如果我们采用较为新的网络请求框架即可避免由于 IPv6 被拒。

再看文档中下图:


这些蓝色框内的 API 默认都是支持 IPv6 的。



所以,我们可以采用 NSURLSession 和 CFNetwork 进行网络请求。

如果采用 NSURLSession,那么当前比较成熟的网络请求框架就是 AFNetworking,最新版本的 AFNetworking 已经使用了 NSURLSession。

查看源码可知,AFN 确实部署了 IPv6 协议:



如果采用 CFNetwork,CFNetwork 的 API 默认是兼容 IPv4 与 IPv6 的。


如此便得以解决 IPv6 被拒的问题,如果不放心,可以自己去 Google 一下 IPv6 的环境部署搭建。在该环境下测试你的代码是否可以进行网络请求。


另外需要注意的是,一些项目中用的第三方 SDK,也可能存在不支持 IPv6 协议的问题。我曾经遇到过的就是 百度地图的 SDK,如果发生了类似的情况,大家去官网下载最新的 SDK 包,即可解决。




原创粉丝点击