如果要进行网络判断,引入AFNetworkReachabilityManager.h即可
+ (void)getRequstUrl:(NSString *)str completion:(void (^)(NSData *))block
{
NSString *urlStr = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString:urlStr];
NSMutableURLRequest *requst = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20];
requst.HTTPMethod = @"GET";
AFHTTPRequestOperation *opretion = [[AFHTTPRequestOperation alloc] initWithRequest:requst];
[opretion setCompletionBlockWithSuccess:^(