[英]Crash when use UIWebview on iPad and iPhone running iOS 10.0 on Wi-Fi connected to an IPv6 network
Iphone應用程序被拒絕的原因是:“在連接到IPv6網絡的Wi-Fi上運行iOS 10.0的iPad和iPhone上進行審查時,我們發現了您的應用程序中的一個或多個錯誤。有人可以幫助解決該問題嗎?
第一次加載應用程序時。 它需要將通知推送到服務器:
- (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來加載我的網站:
- (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];
}
有人可以幫我。 這是我第二次提交申請時被拒絕。
從您的代碼中有兩點要考慮。
1)不推薦使用UIWebView。 WKWebView是Apple推薦的。
2)您正在加載HTTP請求。 如果您使用的是Xcode 8,我認為您可能需要為WKWebView添加一些例外。 “ NSAllowArbitraryLoad”仍然不夠。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.