需要 iPv6 兼容性 - 被苹果拒绝的 iOS 应用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37693256/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
required iPv6 compatibility - iOS app rejected by apple
提问by Brainstorm Technolabs
after June 1, I submit my ionic app to itunes connect and I got the message from apple.
6 月 1 日之后,我将我的 ionic 应用程序提交到 itunes connect,我收到了来自苹果的消息。
Apps are reviewed on an IPv6 network. Please ensure that your app supports IPv6 networks, as IPv6 compatibilityis required.
应用程序在 IPv6 网络上进行审核。请确保您的应用支持 IPv6 网络,因为需要兼容 IPv6 。
For information about supporting IPv6 Networks, refer to Supporting iPv6 DNS64/NAT64 Networks.
有关支持 IPv6 网络的信息,请参阅支持 iPv6 DNS64/NAT64 网络。
For a networking overview, please see About Networking.
有关网络概述,请参阅关于网络。
I have used AFNetworking for API call.
我已经使用 AFNetworking 进行 API 调用。
Please help to find out the solution for the same.
请帮助找出相同的解决方案。
Thanks.
谢谢。
采纳答案by Brainstorm Technolabs
Actually i am calling API using AFNetworking Library.
实际上我正在使用 AFNetworking 库调用 API。
I have just replace the AFNetworkReachabilityManagerclasses from Github with my existing classes. And apple doesn't have problem any more.
我刚刚用我现有的类替换了Github 中的AFNetworkReachabilityManager类。苹果不再有问题。
And my app works now.
我的应用程序现在可以使用了。
回答by gunjot singh
If you are using IPv4-specific APIs or hard-coded IP addresses, you will need to update your code, Although all NSURLSession and CFNetwork APIs(including NSURLConnection) already support IPV6
如果您使用的是 IPv4 特定的 API 或硬编码的 IP 地址,则需要更新您的代码,尽管所有 NSURLSession 和 CFNetwork API(包括 NSURLConnection)都已经支持 IPV6
As mentioned by Apple:
正如苹果所说:
At WWDC 2015 we announced the transition to IPv6-only network services in iOS 9. Starting June 1, 2016 all apps submitted to the App Store must support IPv6-only networking. Most apps will not require any changes because IPv6 is already supported by NSURLSession and CFNetwork APIs.
If your app uses IPv4-specific APIs or hard-coded IP addresses, you will need to make some changes.
在 WWDC 2015 上,我们宣布在 iOS 9 中过渡到纯 IPv6 网络服务。从 2016 年 6 月 1 日开始,所有提交到 App Store 的应用程序都必须支持纯 IPv6 网络。大多数应用程序不需要任何更改,因为 NSURLSession 和 CFNetwork API 已经支持 IPv6。
如果您的应用程序使用特定于 IPv4 的 API 或硬编码的 IP 地址,您将需要进行一些更改。
Although. Apple also recommends not to use IP Address Literals, for long term (Not necessary)
虽然。Apple 还建议不要长期使用 IP 地址文字(不需要)
Don't Use IP Address Literals
Make sure you aren't passing IPv4 address literals in dot notation to APIs such as getaddrinfo and SCNetworkReachabilityCreateWithName. Instead, use high-level network frameworks and address-agnostic versions of APIs, such as getaddrinfo and getnameinfo, and pass them hostnames or fully qualified domain names (FQDNs). See getaddrinfo(3) Mac OS X Developer Tools Manual Page and getnameinfo(3) Mac OS X Developer Tools Manual Page.
Note: In iOS 9 and OS X 10.11 and later, NSURLSession and CFNetwork automatically synthesize IPv6 addresses from IPv4 literals locally on devices operating on DNS64/NAT64 networks. However, you should still work to rid your code of IP address literals
不要使用 IP 地址文字
确保您没有将点表示法中的 IPv4 地址文字传递给 API,例如 getaddrinfo 和 SCNetworkReachabilityCreateWithName。相反,使用高级网络框架和与地址无关的 API 版本,例如 getaddrinfo 和 getnameinfo,并向它们传递主机名或完全限定域名 (FQDN)。请参阅 getaddrinfo(3) Mac OS X 开发人员工具手册页和 getnameinfo(3) Mac OS X 开发人员工具手册页。
注意:在 iOS 9 和 OS X 10.11 及更高版本中,NSURLSession 和 CFNetwork 会自动从在 DNS64/NAT64 网络上运行的设备本地的 IPv4 文字合成 IPv6 地址。但是,您仍然应该努力摆脱 IP 地址文字的代码
If you are using AFNetworking Library, Please make sure to update it to version above 3.x, as they seem to have updated few of the things.--> AFNetworking Added support for IPv6 to Reachability.
如果您正在使用 AFNetworking 库,请确保将其更新到 3.x 以上的版本,因为他们似乎已经更新了一些东西。--> AFNetworking 在可达性中添加了对 IPv6 的支持。
For Detailed Info, please follow this link
有关详细信息,请点击此链接
ALSO, TO TEST
另外,要测试
You can follow this detailed tutorial:
您可以按照此详细教程进行操作:
回答by Maninderjit Singh
Solution for Apple app rejection due to IPv6 Network
IPv6网络导致Apple应用程序被拒绝的解决方案
My internet reachability check for IPv6 is not working well.It always shows absence of network.when I use this code ,apple approved my app within 24 hours. THANKS
我对 IPv6 的互联网可达性检查工作不正常。它总是显示没有网络。当我使用此代码时,苹果在 24 小时内批准了我的应用程序。谢谢
Change the following line in code in AFNetworkingLibrary in Class AFNetworkReachabilityManager
在类AFNetworkReachabilityManager 的AFNetworking库中的代码中更改以下行
CHANGE AF_INET TO AF_INET6;
将 AF_INET 更改为 AF_INET6;
+ (instancetype)sharedManager {
static AFNetworkReachabilityManager *_sharedManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
struct sockaddr_in address;
bzero(&address, sizeof(address));
address.sin_len = sizeof(address);
address.sin_family = AF_INET6; //Change AF_INET TO AF_INET6
_sharedManager = [self managerForAddress:&address];
});
return _sharedManager;
}
EDIT:
编辑:
$ grep -nr 'AF_INET*' .
./Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m:122: address.sin_family = AF_INET;
replace
AF_INET; to AF_INET6;
回答by Parth
Remove dot notation from API URL because IPv6 network not allowed dot notation in URL. I removed from API URL and its work for me.
从 API URL 中删除点表示法,因为 IPv6 网络不允许在 URL 中使用点表示法。我从 API URL 中删除了它对我的工作。