Xamarin iOS 应用被 App Store 拒绝,因为它不能在纯 IPv6 环境中运行

Xamarin iOS app rejected by App Store because not working on IPv6-only environment

Apple App Store 拒绝了我的应用并显示以下消息:

We discovered one or more bugs in your app when reviewed on iPad running iOS 11.4.1 on Wi-Fi connected to an IPv6 network.

因此我(为时已晚)发现,自 2016 年 6 月以来,Apple 要求提交到 App Store 的每个应用程序都应支持纯 IPv6 网络,如此处所写 https://developer.apple.com/support/ipv6/:

Starting June 1, 2016, all apps submitted to the App Store must support IPv6-only networking. A majority of apps will not require any changes as IPv6 is already supported by NSURLSession and CFNetwork APIs. However, if your app utilizes IPv4-specific APIs or hard-coded IP addresses, you will need to make changes. Be sure to test for IPv6 compatibility before submitting your app to the App Store for review.

重点是我的应用程序没有硬编码的 IP 地址,对于所有网络调用,我只是使用默认实现实例化一个 HttpClient;我已经为其他客户提交了基于相同应用程序的其他应用程序,但这是他们第一次因为这个原因拒绝了它。此外,我没有办法用 IPv6 进行测试,因为我的 ISP 不支持它,而且我的两个移动 sims(internet.wind 和 mobile.vodafone.it)的 APN 在 IPv6 中也不起作用.

有没有可能 Apple 只偶尔做一次这个测试,而其他 5/10 的提交我只是幸运?

在我发现问题是由于服务器引起的之后,晚上(我在美国的那个晚上,下午)非常慢,但是阅读文档我发现了这个,这可能对其他人有用: https://docs.microsoft.com/en-us/xamarin/cross-platform/macios/http-stack

April, 2018 – Due to increased security requirements, including PCI compliance, major cloud providers and web servers are expected to stop supporting TLS versions older than 1.2. Xamarin projects created in previous versions of Visual Studio default to use older versions of TLS.

In order to ensure your apps continue to work with these servers and services, you should update your Xamarin projects with the NSUrlSession setting shown below, then re-build and re-deploy your apps to your users.

所以是的,对于 HttpClient 实现,managed 是默认选项,而且几乎可以肯定,如果您在iOS project settings 你会发现那个。但是Xamarin现在建议使用NSUrlSession,所以为了避免以后出现问题还是改一下比较好。

但几乎可以肯定,如果您没有任何硬编码的 IPv6 地址,则无需更改代码中的任何内容: https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html

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. If you aren’t connecting by name, you probably should be.