AFNetWoring同步方法的使用:
NSURL* url = [[NSURL alloc] initWithString:[HOST stringByAppendingString:marker.icon.url]];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
operation.responseSerializer = [AFImageResponseSerializer serializer];
/* 最终继承自 NSOperation,看到这个,大家可能就知道了怎么实现同步的了,也就是利用 NSOperation 来做的同步请求 */
[operation start];
//同步实现
[operation waitUntilFinished];
UIImage* image = (UIImage*)[operation responseObject];
if(image!=nil)
{
//做处理
}
return nil;