WebClient IPv6 AppStore Rejection

My Apple AppStore application was rejected for not supporting IPv6 networks.

Here is declaration of my server URL for WebClient. "ipv4" is IPv4 address of server. I didn't add it here to stay secure.

RemoteServerConnector.Instance.DefaultServerUrl = "http://ipv4/api.php";
Then I have this method to check connection:

private class MyWebClient : WebClient {

    public int timeOut { get; set; }

    protected override WebRequest GetWebRequest(Uri address) {
        WebRequest w = base.GetWebRequest(address);
        w.Timeout = timeOut;
        return w;
    }
   }

   public bool checkInternetConnection() {
            try {
                using(MyWebClient client = new MyWebClient()) {
                    client.timeOut = ApiUrls.RemoteServerConnectorTestTimeout;
                    var removeString = "api.php";
                    var testHttp = DefaultServerUrl.EndsWith(removeString) ? DefaultServerUrl.Remove(DefaultServerUrl.Length - removeString.Length, removeString.Length) : DefaultServerUrl;            

                    using(client.OpenRead(testHttp)) {
                        return true;
                    }
                }
            } catch(WebException ex) {
                return ex.Status != WebExceptionStatus.ConnectFailure;
            } catch(Exception ex) {
                return false;
            }
        }

It always throw exception in IPv6 networks. I already tried this solution Xamarin iOS IPv6 App Store Rejection, but it doesn't work. I also tried to add IPv6 instead of IPv4 in variable DefaultServerUrl. I also tried http://ipv6/api.php and also http://[ipv6]/api.php

Can't find any solution for this type of connection (WebClient). I found only other solutions with TCP/IP protocol and I don't want to change it in my app.

I also saw Xamarin blog about IPv6, but I don't know what to do.

What should I change in my code to make it working? Thank you for your time :)

Best Answers

Answers

Sign In or Register to comment.