开发者

Can we launch setting screen any no of time in iPhone to enable the GPS?

开发者 https://www.devze.com 2023-03-28 00:22 出处:网络
I have tried the launch the settings of iPhone in my application using the call CLLocationManager *locationManager = [[CLLocationManager alloc] init];

I have tried the launch the settings of iPhone in my application using the call

CLLocationManager *locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
[locationManager startUpdatingLocation];
[locationManager release];

but I was able to launch only once,now I am not able to launch the settings in my a开发者_运维技巧pplication. I am using iPhone 3GS with iOS 4.2

Is there any other way to launch settings any no of time if the location services are off.


but I was able to launch only once,now I am not

If you saw an alert kind of msg on your app asking for your permission for using yous gps location. Then this is the default behavior of iPhone OS. if you try to get gps location in any app the OS ask for user's permission. You can not launch this alert again!

but if you wants to change the setting (means wants to enable or disable the location tracking) then you can open the "Settings" application and look for location services setting. You can find your app there and disable the location tracking. But remember you can not open the "Settings" app using your app.


Now this issue is not in iOS5.

If you are calling startUpdatingLoaction method as below code and if location service is off,the system alert will popup and if you tap setting button,it will navigate to phone settings screen. And in phone setting screen you can switch on the location service.

CLLocationManager *locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
[locationManager startUpdatingLocation];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号