2011-03-12 57 views
0

我在我的iPhone代碼中得到下面的崩潰日誌,我無法理解我在做什麼錯誤或如何解決它。需要URLconnection崩潰日誌說明

你的幫助,將真正幫助我的應用程序:)

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; 
+0

你對變量使用@synthesize和@property嗎? – phi 2011-03-12 08:13:58

+0

我已經使用合成如下:@synthesize receivedData; @synthesize nstrUrl; @synthesize urlRequest; – Anand 2011-03-12 08:48:28

+0

在我看來,你是過度釋放HttpConnection實例 – Max 2011-03-12 08:57:33

回答

0

它看起來不像HTTPConnection有超類。例如:

@interface的HttpConnection:CPObject

我不知道這是否會導致您的崩潰或沒有。

+0

對不起,我只是把提取物..它有超類:NSObject – Anand 2011-03-14 06:21:31