30

enter image description here

after June 1, I submit my ionic app to itunes connect and I got the message from apple.

Apps are reviewed on an IPv6 network. Please ensure that your app supports IPv6 networks, as IPv6 compatibility is required.

For information about supporting IPv6 Networks, refer to Supporting iPv6 DNS64/NAT64 Networks.

For a networking overview, please see About Networking.

I have used AFNetworking for API call.

Please help to find out the solution for the same.

Thanks.

Ashish Ramani
  • 1,214
  • 1
  • 17
  • 30

4 Answers4

20

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

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.

Although. Apple also recommends not to use IP Address Literals, for long term (Not necessary)

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

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.

For Detailed Info, please follow this link

Supporting IPv6-only Networks

ALSO, TO TEST

You can follow this detailed tutorial:

tutorial-how-to-test-your-app-for-ipv6-compatibility

gunjot singh
  • 2,578
  • 20
  • 28
  • thanks for reply. I am not using the hard coded IP Address in my app to call API. i have used http://www.xxxxxx.com/API/login.php , So now, what i have to change....? – Ashish Ramani Jun 08 '16 at 05:03
  • Which API class or library are you using, for calling the URL? NSURLConnection or some other? – gunjot singh Jun 08 '16 at 05:07
  • 1
    I think, you should move over to AFNetworking latest release 3.1.0. They have updated few of the things. Added support for IPv6 to Reachability.--> https://github.com/AFNetworking/AFNetworking/pull/3174 – gunjot singh Jun 08 '16 at 05:23
  • 1
    "Make Sure, you are not using IPv4-specific APIs or hard-coded IP addresses." Actually, this is not true. You can use whatever you want as long as your app works correctly on IPv6-only networks. – user102008 Jun 08 '16 at 23:07
  • Yes, you are right! Thanks for pointing it out. I have updated my answer. – gunjot singh Jun 09 '16 at 04:56
  • 1
    we have the same problem and we don't use AFNetworking. Our App is made with Cordova and is coded in Javascript and HTML. All webrequests are https requests for login. Our testscenario is like on this page: https://developer.apple.com/library/mac/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html#//apple_ref/doc/uid/TP40010220-CH213-SW1 The only thing that is not IPV6 is the responding webserver. But if I understand the description right, the server don't have to be IPV6, too. – DeeFour Jul 23 '16 at 06:01
  • 1
    @gunjotsingh , I am using NSURLConnection for calling url , and getting nil response with IPv6 network , Please give me some solution for it. – Bhavesh Nayi Aug 10 '16 at 08:21
  • @BhaveshNayi, NSURLConnection works perfectly over IPv6 network. There should be some other issue behind nil response. Please try printing the NSError value. – gunjot singh Aug 10 '16 at 09:28
  • @ DeeFour, you are right, Servers are not restricted to IPV6. DNS64/NAT64 translators already handles the access to IPV4 servers while requesting from IPV6 network. Is your app working fine over NAT64 network, like mentioned in documentation? – gunjot singh Aug 10 '16 at 09:35
  • @gunjotsingh connectionDidFinishLoading: is called but getting nil NSData response in IPv6 network , it’s working fine in IPv4 network json parsing code NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:receivedData options:kNilOptions | NSJSONReadingAllowFragments | NSJSONReadingMutableContainers error:&error]; getting parsing error becauseof nil receivedData : The data couldn’t be read because it isn’t in the correct format it's all working fine in IPv4 network , also in IPv6 connectionDidFinishLoading: called but why getting nil response ? – Bhavesh Nayi Aug 10 '16 at 09:45
  • Can you please try opening google.com in your safari, while using IPv6 network? This could be an internet sharing issue. – gunjot singh Aug 10 '16 at 09:50
  • @gunjotsingh my app is rejected. Reason: We discovered one or more bugs in your app when reviewed on iPhone running iOS 9.3.4 on Wi-Fi connected to an IPv6 network. We tested it in NAT64 network (setup from mac) and it's working fine , but Apple review team have an issue with IPv6 network. Specifically, the app content failed to load. – Bhavesh Nayi Aug 10 '16 at 11:41
  • @Bhavesh I will need to get my hands on your code, to verify! Can you please create a sample project, to replicate the issue? – gunjot singh Aug 13 '16 at 06:03
  • @gunjotsingh I have a same problem, I check with NAT64 network and its working fine and Apple is still rejected my app with same reason. Do you have any idea? – Nirmalsinh Rathod Nov 18 '16 at 04:37
  • @ Nirmalsinh - Then, i think you should contact them for more issue details! If it is working fine for you on NAT64, then there is no problem! FYI, if you any server response timeout issues in your app, then also they will report it as same issue. – gunjot singh Nov 18 '16 at 05:08
  • I'm using Alamofire '4.0' still apple rejected my app saying **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.** – Neeraj Joshi Feb 23 '17 at 06:12
  • Nij, i don't think there is any issue in Alamofire 4.0, but app rejection could have been caused by some other part of your code! – gunjot singh Feb 23 '17 at 10:06
  • @gunjotsingh i m not using AFnetworking in my app and still app store reject my app with this info information on how to symbolicate and read a crash log, please see Tech Note TN2151 Understanding and Analyzing Application Crash Reports. – Himanshu Moradiya Mar 21 '17 at 06:03
  • @gunjotsingh i m using NSURLSession for call webservice in my app – Himanshu Moradiya Mar 21 '17 at 06:03
  • @HimanshuMoradiya, In your case, App rejection seem to be caused by App Crash and not because of ipv6 support. Please use this for reference https://developer.apple.com/library/content/technotes/tn2151/_index.html – gunjot singh Mar 22 '17 at 11:01
12

Solution for Apple app rejection due to IPv6 Network

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

Change the following line in code in AFNetworking Library in Class AFNetworkReachabilityManager

CHANGE AF_INET TO 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;
Maninderjit Singh
  • 1,419
  • 1
  • 13
  • 23
  • 1
    You should not use reachability checks at all. http://stackoverflow.com/questions/12490578/should-i-listen-for-reachability-updates-in-each-uiviewcontroller#12490864 – Andrew Y Jul 07 '16 at 15:02
  • I have a problem when i check the internet access prior to hitting api.It always shows the messge of internet unavailable. – Maninderjit Singh Jul 07 '16 at 15:07
  • 1
    The apple recommended solution to this is to stop checking the internet access and handle the failures gracefully. – Andrew Y Aug 10 '16 at 14:19
  • Best solution for apple app approval – Maninderjit Singh Aug 24 '16 at 04:17
  • 1
    An observation: sockaddr_in stores IPv4 address, and if you put the sin_family (shared field in sockaddr_* structures) to AF_INET6, then the code that gets this as an argument, assumes the structure is the sockaddr_in6, which has larger size. – Andrew Y Sep 08 '16 at 12:40
  • 1
    this worked for me. actually you need to change AF_INET to AF_INET6 in the whole workspace where ever you have used. great. thanks a lot for saving a lot of time. – Mahesh Agrawal Dec 25 '16 at 19:08
  • Thanks mahesh Agrawal – Maninderjit Singh Dec 27 '16 at 05:05
  • @MaheshAgrawal Just fixing AF_INET to AF_INET6 resolved your issue? – Shobhit C Feb 14 '17 at 09:36
7

Actually i am calling API using AFNetworking Library.

I have just replace the AFNetworkReachabilityManager classes from Github with my existing classes. And apple doesn't have problem any more.

And my app works now.

Ashish Ramani
  • 1,214
  • 1
  • 17
  • 30
0

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.

Parth
  • 634
  • 8
  • 15