需要URLconnection崩溃日志说明

时间:2011-03-12 07:49:44

标签: iphone objective-c nsurlconnection nsurlrequest

我在我的iphone代码中收到以下崩溃日志,但我无法理解我的错误或如何修复它。

你的帮助真的有助于我的应用:)

0  0x03256c97 in objc_msgSend ()
1  0x000005c3 in ?? ()
2  0x02ae7dd9 in URLConnectionClient::_clientDidFinishLoading ()
3  0x02b5b1aa in URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload ()
4  0x02adbdf0 in URLConnectionClient::processEvents ()
5  0x02adbc7a in MultiplexerSource::perform ()
6  0x030765fa in CFRunLoopRunSpecific ()
7  0x030758a8 in CFRunLoopRunInMode ()
8  0x0355c89d in GSEventRunModal ()
9  0x0355c962 in GSEventRun ()
10 0x004c5372 in UIApplicationMain ()

以下是我开始连接的摘录

@interface HttpConnection : NSObject {
    NSMutableURLRequest *urlRequest;
    NSURL *nstrUrl;
    NSMutableData *receivedData;
    NSURLConnection *urlConnection;
}
@property (retain)NSMutableData *receivedData;
@property (retain)NSURL *nstrUrl;
@property (retain)NSMutableURLRequest *urlRequest;

@implementation HttpConnection
    @synthesize receivedData; 
    @synthesize nstrUrl; 
    @synthesize urlRequest;

    NSAutoreleasePool *lpool=[[NSAutoreleasePool alloc] init];  

        nstrUrl = [NSURL URLWithString:url];
    [UIApplication sharedApplication].networkActivityIndicatorVisible=YES;  
    urlRequest = [NSMutableURLRequest requestWithURL:nstrUrl cachePolicy: NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:TIMEOUT_INTERVAL];
    [urlRequest addValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"];
    urlConnection = [[NSURLConnection alloc]initWithRequest:urlRequest delegate:self startImmediately:YES];

    if (urlConnection) { 
        self.receivedData = [[NSMutableData alloc]init];
    } 
    else { 
        NSLog(@"Connection Not Established");
        // inform the user that the download could not be made   
    } 
    [lpool release];

以下是我如何在connectionDidFinishLoading中释放连接对象

[receivedData release];
receivedData=nil;
[urlConnection release];
urlConnection=nil;

1 个答案:

答案 0 :(得分:0)

看起来HTTPConnection看起来不像超类。例如:

@interface HttpConnection:CPObject

我不知道这是否会导致你的崩溃。