点击“确定”按钮时,UIAlertView崩溃



当我点击OK按钮时,我的应用程序崩溃。我进行网络交互,每当出现超时时,我都会抛出此警报消息。

它在iOS6设备上运行良好。我只在iOS7设备上看到这个问题。

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
    if (self.urlConnection == connection) {
        [self stopBlocking];
        NSString *msg = @"Cannot connect to server. Please verify that you have a VPN connection.";
        NSString *title = @"Connection Error";
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title
                                                            message:msg
                                                           delegate:self
                                                  cancelButtonTitle:@"Ok"
                                                  otherButtonTitles:nil];
        [alertView show];
        [alertView release];
        [ServerListener shouldRunSyncMethodTimer:YES];
    }
}

控制台日志中没有错误。未生成崩溃日志

如果不需要委托,请在初始化中将其设置为nil

最新更新