NSData datawithcontentsOfURL 在我的项目中不起作用

发布于 2024-08-16 04:11:54 字数 331 浏览 6 评论 0原文

当我尝试从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

櫻之舞 2024-08-23 04:11:54

确保您有网络连接 - WiFI 或通过电话网络......

Make sure you have network connectivity -- either WiFI or over the phone network....

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文