NSData datawithcontentsOfURL 在我的项目中不起作用
当我尝试从 URL 获取数据时,它返回 nil。但同一条线也适用于其他项目。我已经通过创建新项目对其进行了测试。我的代码在这里
NSData *imgData=[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://image. projectnext.eu/RBXF_Icon.jpg"]];
它在我的测试项目中完美获取数据,但在所需项目中不起作用。我的原始项目中是否需要启用任何设置?
While I m trying to get data from the URL it returns nil. But the same line works in other projects. I have tested it with by creating new project. My code is here
NSData *imgData=[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://image.projectnext.eu/RBXF_Icon.jpg"]];
it gets data perfectly in my test project but not working in needed project. Is there any settings to be enabled in my original project?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保您有网络连接 - WiFI 或通过电话网络......
Make sure you have network connectivity -- either WiFI or over the phone network....