从ASIhttpRequest转换为AFNetwork?

时间:2013-01-10 13:35:07

标签: ios objective-c asihttprequest afnetworking

ASIHTTPRequest中的MY代码是:

 NSURL *url = [NSURL URLWithString:@"http://avicenna-apps.com/harleyeventget.php"];
ASIHTTPRequest *_Request = [ASIHTTPRequest requestWithURL:url];
__weak ASIHTTPRequest * Request=_Request;
[Request setCompletionBlock:^{
    NSData *Data = [Request responseData];
];
[Request setFailedBlock:^{
    NSError *error = [Request error];
      NSlog(@"Error IS %@,error");
}];
[Request startAsynchronous];

如何在AFNetwork中写入?

1 个答案:

答案 0 :(得分:0)

AFHttpClient内,

  (void)getPath:(NSString *)path
     parameters:(NSDictionary *)parameters
        success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
        failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure

这是AFNetworking的官方网站,click