1
wohenyingyu01 OP 这图= =
我把代码复制一遍好了 +(NSString *)requestHTTPGetFromURL:(NSString *)url{ NSString* __block result; NSURLSessionConfiguration *defaultConfigObject = [NSURLSessionConfiguration defaultSessionConfiguration]; NSURLSession *defaultSession = [NSURLSession sessionWithConfiguration: defaultConfigObject delegate: nil delegateQueue: [NSOperationQueue mainQueue]]; NSURL * target = [NSURL URLWithString:url]; NSURLSessionDataTask * dataTask = [defaultSession dataTaskWithURL:target completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { if(error == nil) { result = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding]; NSLog(@"Data = %@",result); }else{ NSLog(@"The error is :%ld",[error code]); } }]; [dataTask resume]; return result; } |
2
xi_lin 2016-03-03 13:19:41 +08:00
实验了一下没有问题
Data = ["GOOGLE","GOOGLE","","","google.com"] |