5
Tôi có mã sau hoạt động tốt nhưng tôi cần kiểm soát nhiều hơn một chút và đặc biệt cần bắt đầu sử dụng mã Khả năng hiển thị trong 0.9.AFNetworking (AFJSONRequestOperation) chuyển thành AFHTTPClient
NSString *urlString = [NSString stringWithFormat:@"http://example.com/API/api.php"];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
_self.mainDictionary = [JSON valueForKeyPath:@"elements"];
[_self parseLiveData];
} failure:^(NSURLRequest *request , NSURLResponse *response , NSError *error , id JSON){
//NSLog(@"Failed: %@",[error localizedDescription]);
}];
if (operation !=nil && ([self.sharedQueue operationCount] == 0)) {
[self.sharedQueue addOperation:operation];
}
Tôi đang đấu tranh để làm việc ra làm thế nào tôi có thể chuyển đổi mã này cùng qua việc sử dụng một AFHTTPClient để tôi có thể tận dụng lợi thế của "setReachabilityStatusChangeBlock".