Skip to content

Commit

Permalink
Merge pull request #70 from jrtapiaO/develop
Browse files Browse the repository at this point in the history
Crash fix - ios8 - CLLocationManager.allowsBackgroundLocationUpdates
  • Loading branch information
Joseph Kalash authored Sep 2, 2016
2 parents 60ff363 + 5687aa7 commit 97219a1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions iOS_SDK/OneSignal/OneSignalLocation.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ + (void) internalGetLocation:(bool)prompt {
locationManager = [[clLocationManagerClass alloc] init];
[locationManager setValue:[self sharedInstance] forKey:@"delegate"];

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
float deviceOSVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
if (deviceOSVersion >= 8.0) {

//Check info plist for request descriptions
//LocationAlways > LocationWhenInUse > No entry (Log error)
Expand All @@ -169,7 +170,9 @@ + (void) internalGetLocation:(bool)prompt {
NSString* alwaysDescription = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"];
if(backgroundModes && [backgroundModes containsObject:@"location"] && alwaysDescription) {
[locationManager performSelector:@selector(requestAlwaysAuthorization)];
[locationManager setValue:@YES forKey:@"allowsBackgroundLocationUpdates"];
if (deviceOSVersion >= 9.0) {
[locationManager setValue:@YES forKey:@"allowsBackgroundLocationUpdates"];
}
}

else if([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"])
Expand Down

0 comments on commit 97219a1

Please sign in to comment.