Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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