0
votes

I completed my first app and try to submit and app store rejected it 2 time with same reason they send me:

We discovered one or more bugs in your app when reviewed on an iPhone running iOS 9.3.2 on Wi-Fi. - During review we were unable to sign into the app as a network error occurred Next Steps

Please run your app on a device to identify the issue(s), then revise and resubmit your app for review.

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

But i tested in my devices with wifi, cellular every type of network it was working fine now m not getting what is the issue i need a solution.

3
What are you using for network fetch, Alamofire or AFNetworking or Native iOS Library?Amit Singh

3 Answers

3
votes

Apple has made IPv6 mandatory since this June. but the library currently do not support IPv6. So what you need to do is copy the library in the main bundle and change the following in NetworkReachabilityManager.swift file

public convenience init?() {
    var address = sockaddr_in()
    address.sin_len = UInt8(sizeofValue(address))
    address.sin_family = sa_family_t(AF_INET6) // Change this from AF_INET to AF_INET6

    guard let reachability = withUnsafePointer(&address, {
        SCNetworkReachabilityCreateWithAddress(nil, UnsafePointer($0))
    }) else { return nil }

    self.init(reachability: reachability)
}

If you are using Pod in your project, you need to unlock the file to change. But again, when ever you will update the Pods, do remember to change AF_INET to AF_INET6

Check You Pod here and select the file as shown

enter image description here

Change AF_INET to AF_INET6 and then you will receive a alert to unlock the file and save the file

enter image description here

To test your app for IPv6 addresses follow

Courtesy : SO Answer

2
votes

See here how AFNetworking is handling the IPv6 in their instance. There is class called sockaddr_in6 for IPv6. You might need that too to handle till the library Alamofire comes with the new update.

Its checking for the version 9.0 and above using IPv6 and for below using IPv4. You app might be crashing on devices lower than version iOS9.0

+ (instancetype)manager
{
    #if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
        struct sockaddr_in6 address;
        bzero(&address, sizeof(address));
        address.sin6_len = sizeof(address);
        address.sin6_family = AF_INET6;
    #else
        struct sockaddr_in address;
        bzero(&address, sizeof(address));
        address.sin_len = sizeof(address);
        address.sin_family = AF_INET;
    #endif

    return [self managerForAddress:&address];
}
0
votes

If you are using AFNetworking, then replace the methods in Reachablity.m

+(Reachability *)reachabilityForInternetConnection
{

#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
    struct sockaddr_in6 address;
    bzero(&address, sizeof(address));
    address.sin6_len = sizeof(address);
    address.sin6_family = AF_INET6;
#else
    struct sockaddr_in address;
    bzero(&address, sizeof(address));
    address.sin_len = sizeof(address);
    address.sin_family = AF_INET;
#endif
    return [self reachabilityWithAddress:&address];

}

+(Reachability*)reachabilityForLocalWiFi
{
#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)

    struct sockaddr_in localWifiAddress;
    bzero(&localWifiAddress, sizeof(localWifiAddress));
    localWifiAddress.sin6_len            = sizeof(localWifiAddress);
    localWifiAddress.sin6_family         = AF_INET6;
    // IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
    localWifiAddress.sin_addr.s_addr    = htonl(IN_LINKLOCALNETNUM);

#else
    struct sockaddr_in localWifiAddress;
    bzero(&localWifiAddress, sizeof(localWifiAddress));
    localWifiAddress.sin_len            = sizeof(localWifiAddress);
    localWifiAddress.sin_family         = AF_INET;
    // IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
    localWifiAddress.sin_addr.s_addr    = htonl(IN_LINKLOCALNETNUM);
#endif
    return [self reachabilityWithAddress:&localWifiAddress];
}