Skip to content

Commit

Permalink
Fix setLocationShared for Wrapper SDK's (#403)
Browse files Browse the repository at this point in the history
• Most OneSignal Wrapper SDK's call init() twice, the first time calls it with a nil appID as the first initialization step, and then init() gets called later on as the wrapper runtime (ie. the React Native runtime) is loaded and initialized
• The problem with this approach is that the SDK also checks to see if it should start sharing location in init()
• So when init() gets called automatically with a nil app ID by wrapper SDK's (before the runtime is loaded), the SDK started sharing location
• This meant location was shared even if developers later on called setLocationShared(false), even if they call it before they called init() with their app ID
• This commit fixes the issue by checking to make sure the app ID exists before checking if it should share location
• Init needs to be refactored in general to be simpler, but this should work as a quick fix.
  • Loading branch information
Nightsd01 authored Aug 26, 2018
1 parent 0e6f3ab commit 6065aa4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion iOS_SDK/OneSignalSDK/Source/OneSignal.m
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ + (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId
if (!success)
return self;

if (mShareLocation)
if (appId && mShareLocation)
[OneSignalLocation getLocation:false];

if (self) {
Expand Down

0 comments on commit 6065aa4

Please sign in to comment.