Replacement for the target property of the CLLocationManager

In iOS 6, the purpose property CLLocationManager, to describe the reason for using location services ( @property(copy, nonatomic) NSString *purpose ), is deprecated.

What replacement, if any, is offered by Apple?

+43
ios deprecated cocoa-touch ios6 cllocationmanager
Sep 24 '12 at 9:23
source share
2 answers

Replacing the purpose property in iOS 6 is the new Info.plist key called NSLocationUsageDescription (aka "Privacy - Description of the use of location").

The key is documented in the key reference information of the list of information properties , but, unfortunately, it is not mentioned with a note about the note of the purpose property.

However, CLLocationManager.h has this comment:

* Deprecated. Define an entire line in Info.plist using the NSLocationUsageDescription key.

In your code, you can set both the key and the purpose property (but you can check whether the location manager responds to this selector first if / when this method is actually deleted in the future).

If you are using iOS 6, the location manager will use the key.
When starting less than iOS 6, the key will be ignored and the purpose property will be used.

+62
Sep 25 '12 at 12:24
source share

I had the same problem in my application.

I found that now you can install the Activity CLLocationManager! . You can select different types of CLActivityTypes, so you no longer need to write your own goal.

Here, for example, for a navigation based application

 [self.gps setActivityType:CLActivityTypeAutomotiveNavigation]; 

Other possible types of CLActivityType:

  - CLActivityTypeFitness - CLActivityTypeOther - CLActivityTypeOtherNavigation 
+3
Sep 25
source share



All Articles