点击OK按钮时UIAlertView崩溃

时间:2014-04-16 05:17:21

标签: ios 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];
    }
}

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

1 个答案:

答案 0 :(得分:0)

如果您不需要代理人在初始化中将其设置为nil

相关问题