views:

49

answers:

2

Hi, 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.

A: 

to get the device info..

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIDevice_Class/Reference/UIDevice.html

NSString *deviceType = [UIDevice currentDevice].model;

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 Saunders
Thanks, this was greatly helpful. I did actually search for awhile but my terminology must not of been correct.
kohlerfc
I don't think this is quite correct, even though it gives the same result. I think you're checking for the sensor that detects if an iPhone is held up to the ear.
Darron
@Darron I believe you are correct, that information should come from the CLLocationManager
Aaron Saunders
+2  A: 

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.

kubi
Thanks kubi, this as you say is a much more robust solution.
kohlerfc