私はAFNetworkingライブラリを使用していますが、次のようにブロックを使用して結果を処理します。
[httpClient HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *op, id response) {
//success clock
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
//error block
}]
コードブロックなしでそれを使用する方法がありますか?たとえば、デリゲートを使用しますか?次のようなもの:
[httpClient HTTPRequestOperationWithRequest:request delegate:self]
と自己クラスで:
-(void)afhttpSuccess:(AFHTTPRequestOperation*)op Response:(id)response {
//success method
}
-(void)afhttpError:(AFHTTPRequestOperation*)op Response:(NSError*)error {
//error method
}