本文介绍了在连接到IPv6网络的Wi-Fi上运行iOS 10.0的iPad和iPhone上使用UIWebview时崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iPhone应用程序被拒绝是因为以下原因:当在连接到IPv6网络的Wi-Fi上运行iOS 10.0的iPad和iPhone上进行审查时,我们发现了您的应用程序中的一个或多个错误."任何人都可以帮助解决它?

Iphone app rejected because of the the reason that "We discovered one or more bugs in your app when reviewed on iPad and iPhone running iOS 10.0 on Wi-Fi connected to an IPv6 network." Anyone can help to solve it?

第一次加载我的应用程序.它需要将通知推送到服务器:

First time when my application load. It need to push notification to server:

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken{

     NSString *token = [[deviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
     token = [token stringByReplacingOccurrencesOfString:@" " withString:@""];
     NSLog(@"Device token is: %@", token);

     NSString *globalToken = [Util objectForKey:@"globalToken"];
     if (globalToken) {
          if ([token isEqualToString:globalToken]) {
               return;
          }
     }

     [Util setObject:token forKey:@"globalToken"];

     NSString *urlString = [NSString stringWithFormat:@"http://api.xosovietnam.vn/ApiPushDevices/save?secret=06btF1Q&platform=IOS&token=%@", token ];
     NSLog(@"%@", urlString);

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

     NSURL *URL = [NSURL URLWithString:urlString];
     NSURLRequest *urlRequest = [NSURLRequest requestWithURL:URL];

     NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {

          ResponseObject *responseObj = [[ResponseObject alloc] init];

          if (!error) {
               NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response;
               if (httpResponse.statusCode == 200) {
                    NSLog(@"Success Push Token.");


               }
          }else{
               responseObj.error = error;

               dispatch_async(dispatch_get_main_queue(), ^{

                    if (error.code == -1009 || error.code == -1004 || error.code == -1003 || error.code == -1005) {
                         NSLog(@"The Internet connection appears to be offline.");
                         UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"Để sử dụng app cần có mạng internet" delegate:nil cancelButtonTitle:@"Huỷ" otherButtonTitles: nil];
                         [alert show];

                    }else{
                         UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:[NSString stringWithFormat:@"%@", error.localizedDescription] delegate:nil cancelButtonTitle:@"Huỷ" otherButtonTitles: nil];
                         [alert show];
                    }

                    return ;

               });
          }
     }];

     [dataTask resume];
}

之后.我创建一个UIWebview来加载我的网站:

After that. I create an UIWebview to load my website:

- (void)viewDidLoad {
     [super viewDidLoad];

     self.automaticallyAdjustsScrollViewInsets = NO;

     if ([self.myWebView respondsToSelector:@selector(setKeyboardDisplayRequiresUserAction:)]) {
          self.myWebView.keyboardDisplayRequiresUserAction = NO;
     }

     NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://xosovietnam.vn/"]];
     [self.myWebView loadRequest:req];

}

有人可以帮助我.这是我第二次提交申请时被拒绝.

Someone can help me please. This is second time I get reject when I subit my application.

推荐答案

从您的代码中考虑两件事.

From your code there are two things to consider.

1)不推荐使用UIWebView.苹果公司推荐 WKWebView .

1) UIWebView is deprecated. WKWebView is recommended by Apple.

2)您正在加载 HTTP 请求.如果您使用的是Xcode 8,我认为您可能需要为WKWebView添加一些例外. "NSAllowArbitraryLoad"仍然不够.

2) You are loading an HTTP request. If you are using Xcode 8, I think you may need to add some exceptions for WKWebView. "NSAllowArbitraryLoad" is still not enough.

这篇关于在连接到IPv6网络的Wi-Fi上运行iOS 10.0的iPad和iPhone上使用UIWebview时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 15:54
查看更多