0

iPhone アプリ内で位置情報サービスを取り消すことはできますか? を から[CLLocationManager authorizationStatus]またはに変更したいと思います。通知ステータスでできるように、 を呼び出します。kCLAuthorizationStatusAuthorizedkCLAuthorizationStatusDeniedkCLAuthorizationStatusRestricted[[UIApplication sharedApplication] unregisterForRemoteNotifications]

4

1 に答える 1

1

+[CLLocationManager authorizationStatus] is a read-only method. That is something a user sets, that is beyond the control of your app.

What you should be doing is stopping the CLLocationManager from updating if you are finished with it. Create a property or iVar for location manager, then when you no longer need updates just call:

[myLocationManager stopUpdatingLocation];

You can also check the authorisation status before starting location updates like so:

if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined || [CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized) {
    // start updating location
}
于 2013-10-30T18:50:12.753 に答える