- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { NSLog(@"Webview load failed with error: %@", error); if(error.code == NSURLErrorCancelled) { // [webView reload]; } { // fake like I've returned! // Orient to Portrait & size to default... [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationPortrait; CGRect screenRect = [[UIScreen mainScreen] bounds]; CGFloat screenWidth = screenRect.size.width; CGFloat screenHeight = screenRect.size.height; [_webview setTransform:CGAffineTransformFromUIOrientation(UIInterfaceOrientationPortrait)]; [_webview setCenter:CGPointMake(screenWidth/2, screenHeight/2)]; _webview.frame = self.view.bounds; //Notify unity loading completed UnitySendMessage("WebViewLoginMediator", "LoadComplete", "true"); return; } }