小编Vim*_*val的帖子

使用AFNetworking 2.0"请求失败:不可接受的内容类型:text/html"

我正在尝试下面的代码,但它给出了错误:

{    
 NSURL *url = [NSURL URLWithString:@"http://ielmo.xtreemhost.com/array.php"];    
 NSURLRequest *urlRequest =[[NSURLRequest alloc]initWithURL:url];    
 AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest];    
 requestOperation.responseSerializer = [AFImageResponseSerializer serializer];    
 [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSLog(@"Response: %@", responseObject);
        _imV.image = responseObject;

    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"Image error: %@", error);
    }];
    [requestOperation start];
}
Run Code Online (Sandbox Code Playgroud)

请帮我解决"Request failed: unacceptable content-type: text/html"错误.

asynchronous ios afnetworking-2

0
推荐指数
2
解决办法
1万
查看次数

标签 统计

afnetworking-2 ×1

asynchronous ×1

ios ×1