Skip to content

Commit 6065aa4

Browse files
authored
Fix setLocationShared for Wrapper SDK's (#403)
• 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.
1 parent 0e6f3ab commit 6065aa4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

iOS_SDK/OneSignalSDK/Source/OneSignal.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ + (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId
423423
if (!success)
424424
return self;
425425

426-
if (mShareLocation)
426+
if (appId && mShareLocation)
427427
[OneSignalLocation getLocation:false];
428428

429429
if (self) {

0 commit comments

Comments
 (0)