5
私は以下のコードをうまく使用していますが、これ以上の制御が必要で、特に0.9のReachabilityコードの使用を開始する必要があります。AFNetworking(AFJSONRequestOperation)を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];
}
私は「setReachabilityStatusChangeBlock」を利用できるように、私はAFHTTPClientの使用に渡って、この同じコードを変換することができますどのように動作するように苦労しています。