这个HTTP调用似乎挂了,我看不出原因.调用后的日志行永远不会运行.
我几乎肯定会做一些非常愚蠢的事情,但如果有人能发现它是什么我会感激不尽.据我所知,我的代码等同于文档.
我使用的URL似乎并不重要,服务器永远不会记录HTTP请求(如果指向一个).
NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com/"]];
NSURLResponse *res = nil;
NSError *err = nil;
NSLog(@"About to send req %@",req.URL);
NSData *data = [NSURLConnection sendSynchronousRequest:req returningResponse:&res error:&err];
NSLog(@"this never runs");
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
更新
感谢到目前为止发布的所有人.还在看问题.更详细一点:
sendAynchronousRequest但在这个实例中,我需要传递一个返回值(我不在主线程上),所以这sendSynchronousRequest是我所知道的唯一选项.NSURLCache协议,特别是cachedResponseForRequest方法,这需要我返回一个NSCachedURLResponse 也许以前有人见过...我有一个私有模块要包含在我的应用程序中。我已将其作为Gemfury上的tarball引用,并且在库的多个版本上都可以在本地正常工作(始终如此),但是Joyent框上的“ npm install”会输出以下错误。
NPM似乎已成功拉下模块,然后尝试(失败)在注册表中查找它。
我认为我在做一些愚蠢的事情。有什么想法吗?
注意:
我也尝试通过package.json中的git URL引用模块。SSH似乎可以连接,因为它询问我是否信任github.com的IP和RSA指纹,但随后NPM再次击中注册表并得到404。我猜测这与软件包有关,但是可以吗? t在本地复制。
npm http GET https://npm.fury.io/--token--/richmarr/cake-lib/-/latest.tgz
npm http 200 https://npm.fury.io/--token--/richmarr/cake-lib/-/latest.tgz
npm http GET https://registry.npmjs.org/cake-lib/0.0.10
npm http 404 https://registry.npmjs.org/cake-lib/0.0.10
npm ERR! 404 'cake-lib' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, or http url, or git url.
npm ERR! System SunOS 5.11
npm ERR! command "/opt/nodejs/v0.10.21/bin/node" …Run Code Online (Sandbox Code Playgroud)