【发布时间】:2015-08-10 20:16:52
【问题描述】:
我正在尝试使用AFNetworking 2.0 向服务器发送发布请求
NSDictionary * dict = @{@"credentials": @{
@"name": @"Valod",
@"password": @"test"
}
};
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.responseSerializer = [AFJSONResponseSerializer serializerWithReadingOptions:NSJSONReadingAllowFragments];
[manager POST:URL parameters:dict success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];`
但我得到了错误
Error Domain=NSCocoaErrorDomain Code=3840 “操作无法完成。(Cocoa 错误 3840。)”(字符 0 周围的值无效。) UserInfo=0x7fd6214a5d70 {NSDebugDescription=字符 0 周围的值无效,NSUnderlyingError=0x7fd62150ec60 “请求失败:内部服务器错误 (500)”}
我用谷歌应用测试api调用。响应json is valid json
【问题讨论】:
-
我看到了这篇文章,但对我没有帮助
标签: ios xcode6 afnetworking