2013-03-05 37 views
0

我正在使用xcode 4.6,並且啓用了ARC。我想將一些圖像添加到來自服務器的UItableview行。 我收到錯誤,如:獲取錯誤對象0xa2b6f50出現錯誤:malloc:***錯誤:釋放指針未分配***在malloc_error_break中設置斷點以進行調試

的malloc:*錯誤對象0xa2b6f50:指針被釋放沒有被分配 *設置malloc_error_break斷點調試

這裏是我的代碼:

NSURL * imageURL = [NSURL URLWithString:[templateURL stringByAppendingFormat:@「%@」,[[templateArray objectAtIndex:i] objectForKey:@「options_picture」]]];

 UIImageView *templateView=[[UIImageView alloc]initWithFrame:CGRectMake(x1, y1, wid, ht)]; 
     NSLog(@"templeteArray %@",imageURL); 

     AsyncronousUIImage *image=[[AsyncronousUIImage alloc]init]; 
     [image loadImageFromURL:imageURL inImageView:templateView]; 
     image.delegate=self; 
     [templateScroll addSubview:templateView]; 

的AsyncronousUIImage類如下:

- (void)loadImageFromURL:(NSURL *)anUrl inImageView:(UIImageView*)imgView{ 

imageView = imgView; 
NSURLRequest *request = [NSURLRequest requestWithURL:anUrl 
              cachePolicy:NSURLRequestReturnCacheDataElseLoad 
                    timeoutInterval:30.0]; 
connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];} 

- (void)connection:(NSURLConnection *)theConnection didReceiveData:(NSData *)incrementalData { 

if (data == nil) 
data = [[NSMutableData alloc] initWithCapacity:2048]; 

[data appendData:incrementalData]; 

    } 

- (void)connectionDidFinishLoading:(NSURLConnection *)theConnection 
    { 
      [self initWithData:data]; 
      data = nil; 
      connection = nil; 
     [self.delegate imageDidLoad:self]; 
     } 

任何幫助表示讚賞。

回答

相關問題