I am using a block to download images in asynchronus call . I know how to use block in this way
[self getimage:url block:^(UIImage *img)
{
passblock(img);
}];
but i dont know how to use block in this
[NSThread detachNewThreadSelector:@selector(getimage:block:) toTarget:self withObject:string];
When this block is going to get callback in nsthread and how to handle it.
While doing this error that i am getting is bad access
-(void)getimage:(id)strimage block:(imageblock)block
{
NSData *data=[NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:strimage]];
UIImage* image = [UIImage imageWithData:strurl];
block(image);
}
Any help will be appreciated.
The selector passed to detachNewThreadSelector must take only one argument.
Source