NSURLRequest、NSURLConnection 版本信息
我正在实现类似于 这个例子。但是,我还需要支持旧版 iOS 版本(3.0 及更高版本)的设备。所以,我的问题是:哪些版本将支持此功能?
另外,我一直在使用尝试创建对象并检查它是否为空的技术作为确保向后兼容性的一种方法。但是,如果有一种方法可以直接检查版本,那就太好了。
I'm implementing background fetching similar to this example. However, I also need to support devices with older iOS versions (3.0 and up). So, my question is: What versions will support this?
Also, I've been using the technique of attempting the create the object and checking if it is null as a means of insuring backward compatibility. However, if there is a way of checking the version directly, that would be great also.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
乍一看,我没有看到该代码中有任何 ios 3.0 不可用的内容。因此你应该没问题。
NSURLConnection 在 iOS 2.0 及更高版本中可用
当您构建时,只需确保将 iOS 部署目标设置为 3.0
At a glance I don't see anything in that code that isn't available with ios 3.0. Therefore you should be OK.
NSURLConnection is Available in iOS 2.0 and later
When you build just ensure you set your iOS Deployment Target to 3.0
上面的代码看起来是3.0兼容的。如果您确实需要知道操作系统的版本,您可以致电:
另外,我查看了您正在使用的示例,似乎存在严重的内存泄漏。该行:
将 mutData 的保留计数设置为 2,这可能意味着它永远不会被释放。
The above code appears to be 3.0 compatible. If you do need to know the version of the OS you can call:
Also, I looked a the example you're using and there appears to be a significant memory leak. The line:
Sets the retain count of mutData to 2, which probably means it won't ever get released.