I'm using the CLLocationManager in SpringBoard or imagent but when I alloc the CLLocationManager, I got the error with:depending on legacy on-demand authorization, which is not supported for new apps
.
even in locationd process, I got the same situation...
%hook SpringBoard
-(void)applicationDidFinishLaunching: (id)application {
CLLocationManager *locationMgr = [[CLLocationManager alloc] init];
%orig;
}
%end
The question is how can I get the location information in such process? Or if I can change entitlement for the app?
It's all due to iOS 8 changes. On previous iOS versions at least locationd
had com.apple.locationd.preauthorized
entitlement which gives access to location without user permission. Now even locationd
doesn't have it. Same with SpringBoard
and imagent
. Of course, being locationd
it can access location through it's own APIs - locationd
is the location daemon that handles everything from authorization to filtering and processing raw location data from various sources.
You can change their Info.plist
but it will not do much - those apps will still not be authorized. With SpringBoard
you will have to display default alert to allow it to access location. With locationd
and imagent
you probably can't do anything - they're daemons. Daemons doesn't have UI so they can't display any alerts to request permission. To solve this system daemons use entitlements to access something without user permission (like personal info).
Now, how you can solve it apart from requesting permission from user for SpringBoard
:
com.apple.locationd.preauthorized
entitlement. That way you can access location without any permissions. Your daemon will be always authorized to do so by default.com.apple.locationd.preauthorized
. It's kind of hack, which I'm personally against of in this case as writing a daemon solves all the problems. If you still want to do it that way then read my answer here