2
我還提交了一個問題here。AFNetworking Exception when Using Example from Readme
自述使用此代碼:
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。
如何解決此異常?
我創建了一個空應用程序,添加了AFNetworking版本2文件從主,並添加此代碼在我的應用程序委託。它運行良好。你嘗試過嗎? –
這是在模擬器上還是在實際設備上發生的?有相同的問題,但只在模擬器上。 –
@TonceanCosmin查看我的回答。 –