I want users to be prompted as soon as app launches for permission to access Motion & Fitness data (CoreMotion).
Right now I'm trying to do a "dummy" query for the data to prompt the permission on a application:didFinishLaunchingWithOptions
CMMotionActivityManager *motionActivityManager=[[CMMotionActivityManager alloc]init];
[motionActivityManager startActivityUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMMotionActivity *activity) {
NSLog(@"Dummy query to prompt permission from user");
}];
But what happens is the app launches and it hangs on the splash screen — if I press home button then the app tries closing and THEN the permission prompt pops in.
Any thought how to accomplish this?