Supporting IPv6 on iOS App (Keep getting rejected although it works in tests)
<p>I am trying for quite some time to deploy an app but it keeps getting rejected as it doesn't work on Apple's IPv6 only network, even though I am using NSURLSession to send a POST. I have made more attempts than I can count and ran out of options, does anyone know if it is a problem related to their testing environment or it is to my code?
Here it is the code:        </p>

<pre><code>    - (NSData *) postToServer: (NSData *) msg {

        __block NSData *urlData = NULL;
        self.status = @"offline";
        dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);

        NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
        NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];

        NSURL *url = [NSURL URLWithString:@"http://myserver.php"];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0];
        [request setHTTPMethod:@"POST"];
        [request setHTTPBody:msg];

        NSURLSessionDataTask *postDataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {

            if (error) {
                self.status = @"offline";
                dispatch_semaphore_signal(semaphore);
                return;
            }

            if ([response isKindOfClass:[NSHTTPURLResponse class]]) {

                NSInteger statusCode = [(NSHTTPURLResponse *)response statusCode];

                if (statusCode &gt;= 200 &amp;&amp; statusCode &lt; 300) {

                    self.status = @"online";
                    urlData = data;

                }
                else {

                    self.status = @"offline";

                }
                NSLog(@"Código resposta: %ld / Resposta ==&gt; %@", (long)statusCode, [[NSString alloc] initWithData:urlData encoding:NSUTF8StringEncoding]);
            }
            dispatch_semaphore_signal(semaphore);

        }];
        [postDataTask resume];

        dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);

        return urlData;

    }
</code></pre>

<p>Please, if I have made anything wrong on this help me fix it, this is delaying my work schedule so much and I could not figure it out even reading all Apple forum's threads about IPv6. (This code works at my workplace for iPhone SE iOS 9.3.2, only fails at the review).<br>
Thanks for the help.<br>
Natan</p>