小编Kia*_*rom的帖子

使用AFNetworking 2 POST请求时的Cocoa错误3840

我调用此函数并每次返回Cocoa Error 3840.我尝试调试并修复它,它在请求时出错,而不是在解析结果时出错


我在请求时在故障块中发现了这个错误.

Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x109230960 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not et.}
2013-11-01 12:09:30.925 MagicBox[87431:70b] The operation couldn’t be completed. (Cocoa error 3840.)
Run Code Online (Sandbox Code Playgroud)

这是我的代码在此先感谢.

- (void)loginWithUserName:(NSString *)userName
             Password:(NSString *)password
           orFacebook:(NSString *)facebookID
    withResponseBlock:(ResponseBlock)responseBlock {

if (!userName && !facebookID) {
    NSError *error = [NSError errorWithDomain:@"Missing Parameters" …
Run Code Online (Sandbox Code Playgroud)

objective-c ios afnetworking

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

AFNetworking for JSON解析出错

我有以下JSON解析代码:

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://www.dropbox.com/s/qz16qyi3julygl9/facebook.json"]];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {

    NSLog(@"Request Success %@",[JSON class]);

} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {
    NSLog(@"Request Failure Because %@",[error userInfo]);
}];

[operation start];
Run Code Online (Sandbox Code Playgroud)

但我有Request Failure并出现以下错误消息:

NSErrorFailingURLKey =" https://www.dropbox.com/s/qz16qyi3julygl9/facebook.json "; NSLocalizedDescription ="预期内容类型{(\n \"text/json \",\n \"application/json \",\n \"text/javascript \"\n)},得到text/html";

有人能帮助我吗?

json ios afnetworking

3
推荐指数
1
解决办法
5503
查看次数

Node.js + Express仅适用于测试服务器上的端口3000

在本地测试它工作.在不同的港口(3001,8080)

但在测试服务器(Azure)上

我在同一台机器上运行了2个Node App实例

$ node api1/index.js (on port 3000)
$ node api2/index.js (on port 3001)
Run Code Online (Sandbox Code Playgroud)

$ node api1/index.js (on port 3001)
$ node api2/index.js (on port 3000)
Run Code Online (Sandbox Code Playgroud)

但它只适用于端口3000.

如何在Express中设置不同的端口?

现在,我已经在index.js的app.listen(3001)上进行了更改,但它无效.

azure node.js express

1
推荐指数
1
解决办法
2352
查看次数

标签 统计

afnetworking ×2

ios ×2

azure ×1

express ×1

json ×1

node.js ×1

objective-c ×1