iOS网络框架 AFNetworking
fmms
13年前
AFNetworking 是 iOS 一个使用很方便的网络开发框架。示例代码:
NSURL *url = [NSURL URLWithString:@"https://gowalla.com/users/mattt.json"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) { NSLog(@"Name: %@ %@", [JSON valueForKeyPath:@"first_name"], [JSON valueForKeyPath:@"last_name"]); } failure:nil]; [operation start];