Iphone 我正在使用默认的UITableViewCell。我想在本地服务器的单元格上设置映像…cell.imageView.image

Iphone 我正在使用默认的UITableViewCell。我想在本地服务器的单元格上设置映像…cell.imageView.image,iphone,objective-c,cocoa-touch,uitableview,uiimage,Iphone,Objective C,Cocoa Touch,Uitableview,Uiimage,应用程序正在崩溃。有人能告诉我我做错了什么吗?有没有内存相关的问题 BLImageCache *sharedImageCache = [BLImageCache sharedInstance]; NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:indexPath ,@"IndexPath", nil] ; NSString *urlString; urlString = [[mNewsArray obje

应用程序正在崩溃。有人能告诉我我做错了什么吗?有没有内存相关的问题

BLImageCache *sharedImageCache = [BLImageCache sharedInstance];
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:indexPath ,@"IndexPath", nil] ;
NSString *urlString;
urlString = [[mNewsArray objectAtIndex:indexPath.row] objectForKey:@"imgUrl"];
urlString =[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
UIImage *image=[sharedImageCache imageForURL:urlString];
if(image==nil)
{
    urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

   [sharedImageCache loadImageFromURL:[NSURL URLWithString:urlString] sender:self context:(NSDictionary*)dictionary];
}
else{
    cell.imageView.image =image;
    cell.imageView.contentMode = UIViewContentModeScaleAspectFit;       
}

回溯会有帮助。它在哪里坠毁


我可以立即看到的问题是,在远程加载时,您两次转义
urlString
。另外,如果
urlString
恰好为零,当您尝试将其转换为创建
NSURL

时,您会遇到崩溃。您能给我几行代码,我可以通过它们来解决ma crashNo问题吗。如果不知道坠机的原因,那是不可能的。
-(void)didLoadImage:(UIImage *)inImage contextInfo:(void *)inContext
{
    if(inImage )
    {
        NSIndexPath *indexPath= [(id)inContext objectForKey:@"IndexPath"];

        UITableViewCell *cell=[mTableView cellForRowAtIndexPath:indexPath];

        inImage=[inImage resizeImagewithwidth:69 height:67];

        cell.imageView.image=inImage;
    }

}