Create simple app with iOS 7 SDK but test app on both ios 6.x and 7.x and have same result. There are two ViewControllers – first MainScreen and second WebScreen
If i using NSURLConnection on MainScreen for my url, UIWebView not load content from same site.
In the MainScreen i load json as string from url
NSString *urlAsString = [NSString stringWithFormat:@"https://site.ws/api/index/index?method=get_count_new_orders&login=%@&password=%@", @"login", @"pass"];
NSURL *url = [[NSURL alloc] initWithString:urlAsString];
[NSURLConnection sendAsynchronousRequest:[[NSURLRequest alloc] initWithURL:url] queue:[[NSOperationQueue alloc] init] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
if (error) {
NSLog(@"error ::: %@", error);
} else {
NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSError *jserror = nil;
NSDictionary *JSON = nil;
JSON = [NSJSONSerialization JSONObjectWithData: [string dataUsingEncoding:NSUTF8StringEncoding] options: NSJSONReadingMutableContainers error: &jserror];
}
}];
On the second screen i try load page from same site:
NSString *stringUrl = [NSString stringWithFormat:@"https://reserva.ws/?lang=en"];
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:stringUrl]]];
and UIWebView load empty page.
But, if i comment [NSURLConnection sendAsynchronousRequest... on first screen, webview work fine.