#import "ATNetworking.h"
查询 API。
[[ATNetworking sharedInstance] requestURL:@"https://www.googleapis.com/books/v1/volumes?q=harry+potter" completionHandler:^(NSDictionary *item, NSArray *items, NSError *error, NSDictionary *errorDictionary, NSURLResponse *response, NSDictionary *data) {
if(!error){
// Populates 'items' on API responses that contain list of objects.
// Populates 'item' on API responses that contain a single object.
}else{
NSLog(@"An error occurr: %@", error.userInfo[NSLocalizedDescriptionKey]);
}
}];
在 Xcode 中打开项目/ATNetworking.xcworkspace,然后按 Command-U