使用自述文件中的示例时AFNetworking异常

时间:2013-09-28 19:01:05

标签: ios afnetworking afnetworking-2

我还提交了一个问题here

使用自述文件中的代码:

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager GET:@"http://www.google.com" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    NSLog(@"Error: %@", error);
}];

抛出以下异常:

2013-09-27 22:16:10.345 Grades[1000:60b] -[AFHTTPRequestOperation setResponseSerializer:]: unrecognized selector sent to instance 0x1666c3f0
2013-09-27 22:16:10.349 Grades[1000:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AFHTTPRequestOperation setResponseSerializer:]: unrecognized selector sent to instance 0x1666c3f0'
*** First throw call stack:
(0x2ee83f53 0x396926af 0x2ee878e7 0x2ee861d3 0x2edd5598 0xe49ed 0xe4c4d 0x100b93 0x3160f3db 0x31723c57 0x3160f3db 0x316759e7 0x31675971 0x315ed48f 0x2ee4f1d5 0x2ee4cb79 0x2ee4cebb 0x2edb7ce7 0x2edb7acb 0x33ab2283 0x31659a41 0xf1075 0x39b9aab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

我已确认所有AFNetworking文件都已更新为2.0。

如何解决此异常?

1 个答案:

答案 0 :(得分:4)

问题是某些文件未正确更新。尝试从项目目录中删除所有AFNetworking文件,清理并构建,安装新文件,然后再次清理和构建。