【问题标题】:For Soap NSURLConnection, Please ensure that your app supports IPv6 networks, as IPv6 compatibility is required对于 Soap NSURLConnection,请确保您的应用程序支持 IPv6 网络,因为需要 IPv6 兼容性
【发布时间】:2016-10-29 00:12:42
【问题描述】:

我已经在 AppStore 中提交了我的应用,如果由于以下原因,他们会拒绝。

Hello,

        Thank you for providing this information. Upon further review, we were still unable to login to the app.

        Please note that 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.

        Best regards,

        App Store Review

我正在使用 SOAP Envelope 服务来使用它,

这是我的代码

@property(retain,nonatomic)NSString *xmlString;

@property(nonatomic,retain)NSMutableData *webResponseData;


-(void)method_GetUpcomingLotteries
{

    NSString *soapMessage = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                             "<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:ns1=\"urn:Lottery.Intf-ILottery\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:enc=\"http://www.w3.org/2003/05/soap-encoding\">\n"
                             "<env:Body>\n"
                             "<ns1:GetUpcomingLotteries env:encodingStyle=\"http://www.w3.org/2003/05/soap-encoding\">\n"
                             "<EntityID xsi:type=\"xsd:int\">2</EntityID>\n"
                             "<Password xsi:type=\"xsd:string\">Smart@Winners</Password>\n"
                             "<SortBy xsi:type=\"xsd:int\">0</SortBy>\n"
                             "<limit xsi:type=\"xsd:int\">0</limit>\n"
                             "</ns1:GetUpcomingLotteries>\n"
                             "</env:Body>\n"
                             "</env:Envelope>"];


    NSURL *sRequestURL = [NSURL URLWithString:@"http://isapi.mekashron.com/soapclient/soapclient.php?"];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:sRequestURL];
    NSString *sMessageLength = [NSString stringWithFormat:@"%d", [soapMessage length]];

    [request addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
    [request addValue: @"urn:Lottery.Intf-ILottery/GetUpcomingLotteries" forHTTPHeaderField:@"SOAPAction"];
    [request addValue: sMessageLength forHTTPHeaderField:@"Content-Length"];

    [request setHTTPMethod:@"POST"];



    [request setHTTPBody:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];

    NSLog(@"soapMessage===\n %@",soapMessage);

    NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];

    if( theConnection ) {
        NSLog(@"hiii");
        self.webResponseData = [NSMutableData data];
    }else {
        NSLog(@"Some error occurred in Connection");

    }
}



- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    NSLog(@"Received Bytes from server: %lu", (unsigned long)[self.webResponseData length]);

    NSString * strXml = [[NSString alloc] initWithBytes: [self.webResponseData mutableBytes] length:[self.webResponseData length] encoding:NSUTF8StringEncoding];

    NSLog(@"---- %@" ,strXml);



}

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {

    [self.webResponseData  setLength:0];
}

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
    [self.webResponseData  appendData:data];
}

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
    NSLog(@"Some error in your Connection. Please try again.");


}

我的问题:

1) 请告诉我我需要更改方法还是必须更改服务器端才能将我的 API 从 IPv4 传输到 IPv6?

2) 在 ios9 下使用 SOAP 方法的 IpV6 代码可以替代 NSURLConnection

【问题讨论】:

标签: ios objective-c xcode soap ipv6


【解决方案1】:

在 WWDC 2015 上,Apple 宣布在 iOS 9 中过渡到仅限 IPV6 的网络服务。现在从 2016 年 6 月 1 日起,Apple 强制要求该应用程序必须支持 iPV6。

如果开发人员使用苹果提供的标准网络 API,如 NSURLSession 和 CFNetwork API,他们应该不会遇到任何问题。否则,您必须将代码移至支持 IPV6 的 API。

如果您正在寻找使用一些标准网络库,例如 AFNetworking。据此siteAFNetworking 3.0 支持IPV6。

Apple 在how to test IPV6 support 上有一个文档。

【讨论】:

  • 请检查我使用我的soap api做什么?我必须将服务器端的 API 更改为 ipV6 吗?
  • 他们不强制更改服务器站点,只强制客户端更改。根据他们的文档 NSURLConnection 它属于 CFNetwork API,所以应该没问题。但是由于在 iOS 9 中,大多数 NSURLConnection 的 API 都已被弃用,可能是他们鼓励使用 NSURLSession。但是 NSURLConnection 根据他们的文档不应该给出问题。如果您使用了硬编码的 IP 地址,例如“10.0.1.121”,请使用 DNS。现在我只能建议你根据文档测试 IPV6 支持,看看是否能找到任何错误日志。
猜你喜欢
  • 2016-10-14
  • 1970-01-01
  • 2016-11-07
  • 2017-01-06
  • 2016-10-24
  • 1970-01-01
  • 2017-06-07
  • 1970-01-01
  • 2011-03-27
相关资源
最近更新 更多