关闭 iPhone 或 iPod touch 设备上依赖的功能
我有一个我认为相对简单的问题,但我还找不到答案。我有一个 iPhone 应用程序,它在其中一个屏幕上使用 GPS。我想在应用程序加载时使用代码禁用此屏幕,因此在使用 iPod touch 时禁用它。因此它在 iPod touch 上仍然有用,因为 iPod touch 用户可以使用很多功能。
谢谢。
I have what i thought was a relatively simple question but i cannot find an answer to it yet. I have an iPhone app that uses GPS on one of its screens. I want to disable this screen using code when the app loads,so disable it when a iPod touch is being used. This is so it can still be useful on a iPod touch as there is a lot of functionality that a iPod touch user can use.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
获取设备信息..
http: //developer.apple.com/library/ios/#documentation/UIKit/Reference/UIDevice_Class/Reference/UIDevice.html
我认为如果您只是检查 GPS 那么您将需要访问 CLLocationManager 来查看是否它打开或关闭
to get the device info..
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIDevice_Class/Reference/UIDevice.html
I think if you are just checking for GPS then you will need to access the CLLocationManager to see if it is on or off
您可以通过@Aaron 的答案到达那里,但这不是这样做的方法。使用
[CLLocationManager locationServicesEnabled];
来判断您是否可以确定用户的位置。这比根据设备模型做出决策要稳健得多。You can get there with @Aaron's answer, but that's not the way to do it. Use
[CLLocationManager locationServicesEnabled];
to tell if you can determine the users's location. This is a lot more robust than making decisions based on the device model.