【发布时间】:2012-11-18 22:04:41
【问题描述】:
我有这个代码:
[NSURLConnection sendAsynchronousRequest:urlRequest queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
{
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
if ( error != nil )
{
// Display a message to the screen.
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"There was a server error getting your business plan. We use a remote server to backup your work."
message:@"Please make sure your phone is connected to the Internet. If the problem persists, please let us know about this."
delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[message show];
但它在 NSUrlConnection 从服务器返回时执行。它在极少数情况下会造成崩溃。可能吗?这似乎是一段无害的代码。
谢谢!
【问题讨论】:
-
您的消息内容是从
NSURLConnection中提取的吗? -
这段代码在哪里?它是否放置在
NSURLConnectionDelegate指定的委托方法中?如果是这样,问题就在于此。如果您可以发布更多示例代码,我们将更容易为您提供帮助。 -
@esqew 不,内容只是纯文本。
-
刚刚发布了一个更大的代码时钟。
标签: ios ios5 nsurlconnection