简体   繁体   English

在连接到IPv6网络的Wi-Fi上运行iOS 10.0的iPad和iPhone上使用UIWebview时崩溃

[英]Crash when use UIWebview on iPad and iPhone running iOS 10.0 on Wi-Fi connected to an IPv6 network

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? Iphone应用程序被拒绝的原因是:“在连接到IPv6网络的Wi-Fi上运行iOS 10.0的iPad和iPhone上进行审查时,我们发现了您的应用程序中的一个或多个错误。有人可以帮助解决该问题吗?

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];
}

After that. 之后。 I create an UIWebview to load my website: 我创建一个UIWebview来加载我的网站:

- (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 is deprecated. 1)不推荐使用UIWebView。 WKWebView is recommended by Apple. WKWebView是Apple推荐的。

2) You are loading an HTTP request. 2)您正在加载HTTP请求。 If you are using Xcode 8, I think you may need to add some exceptions for WKWebView. 如果您使用的是Xcode 8,我认为您可能需要为WKWebView添加一些例外。 "NSAllowArbitraryLoad" is still not enough. “ NSAllowArbitraryLoad”仍然不够。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在连接到 IPv6 网络的 Wi-Fi 上运行 iOS 10.0 - running iOS 10.0 on Wi-Fi connected to an IPv6 network 在以下情况下,您的应用在运行iOS 11.1且已连接到IPv6网络的iPad和iPhone上崩溃了: - Your app crashed on iPad and iPhone running iOS 11.1 connected to an IPv6 network when we: 您的应用程序在连接到IPv6网络的运行iOS 11.2.5的iPad或iPhone上崩溃,但为什么? - Your app crashed on iPad or iPhone running iOS 11.2.5 connected to an IPv6 network but Why? 在运行连接到IPv6的iOS 9.3.5的iPad和iPhone上,应用程序崩溃 - App crashes on iPad and iPhone running iOS 9.3.5 connected to an IPv6 准则2.1-性能在我们的审查过程中,您的应用程序在运行iOS 11.2.5且连接到IPv6网络的iPad或iPhone上崩溃了 - Guideline 2.1 - Performance Your app crashed on iPad or iPhone running iOS 11.2.5 connected to an IPv6 network during our review 如何检测iOS用户是否通过Wi-Fi连接到蜂窝网络? - How to detect if an iOS user is connected to cellular network versus wi-fi? 向连接到 Wi-Fi 网络的所有设备发送通知 - Send notification to all the devices connected to a Wi-Fi network 在iPhone上使用3G代替已连接的Wi-Fi - using 3G instead connected Wi-Fi on iPhone iPhone SDK是否可以获取当前连接的Wi-Fi SSID? - Can the iPhone SDK obtain the Wi-Fi SSID currently connected to? 在没有现有Wi-Fi网络的情况下将Raspberry Pi连接到iPhone - Connect Raspberry Pi to iPhone without existing Wi-Fi network
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM