views:

25

answers:

1
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;       
}

The Application is crashing can Anyone tell me what I am doing wrong is there any Memory related Issue...

-(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;
    }

}   
A: 

A backtrace would help. Where is it crashing?

The problems I can see immediately is that you are escaping urlString twice when loading remotely. Also, if urlString happens to be nil, you'll get a crash when you try to convert it to create the NSURL.

Daniel Dickison
Can You give me couple of lines of code by which i can solve ma crash
Er.Priyank Maheshwari
No. That's impossible without knowing what the crash is.
Daniel Dickison