From 966d072fd8d6bf8fa122c2aae68590e0dde63ad6 Mon Sep 17 00:00:00 2001 From: Nan Date: Tue, 6 Aug 2024 12:23:27 -0700 Subject: [PATCH 1/2] Log Fatal log for null app ID only on native SDK * Wrapper SDKs will automatically initialize with null app ID. * On wrappers, this fatal log is very misleading, so only log if this happens on the native SDK. * Most wrappers also have type signatures indicating app ID should be non-null for the public initialize API --- iOS_SDK/OneSignalSDK/Source/OneSignal.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/iOS_SDK/OneSignalSDK/Source/OneSignal.m b/iOS_SDK/OneSignalSDK/Source/OneSignal.m index c3937cdbd..b18d5ffdc 100755 --- a/iOS_SDK/OneSignalSDK/Source/OneSignal.m +++ b/iOS_SDK/OneSignalSDK/Source/OneSignal.m @@ -293,7 +293,10 @@ + (void)setAppId:(nullable NSString*)newAppId { + (BOOL)isValidAppId:(NSString*)appId { if (!appId || ![[NSUUID alloc] initWithUUIDString:appId]) { - [OneSignalLog onesignalLog:ONE_S_LL_FATAL message:[NSString stringWithFormat:@"OneSignal AppId: %@ - AppId is null or format is invalid, stopping initialization.\nExample usage: 'b2f7f966-d8cc-11e4-bed1-df8f05be55ba'\n", appId]]; + if (!OneSignalWrapper.sdkType) { + // Fatal log if not a wrapper SDK, wrappers will call init with null App Id + [OneSignalLog onesignalLog:ONE_S_LL_FATAL message:[NSString stringWithFormat:@"OneSignal AppId: %@ - AppId is null or format is invalid, stopping initialization.\nExample usage: 'b2f7f966-d8cc-11e4-bed1-df8f05be55ba'\n", appId]]; + } return false; } return true; From d2eca16240d97704be798bfffa70b11975a80f17 Mon Sep 17 00:00:00 2001 From: Nan Date: Tue, 6 Aug 2024 11:40:11 -0700 Subject: [PATCH 2/2] Remove `setLaunchOptions` from OneSignal header * This was added to the OneSignalFramework header file to expose to wrappers. * However, wrappers do not actually use this because they must initialize the SDK (not sufficient to only set launch options) so cold start click listeners can be triggered. * Remove from header so it is not misleading, which suggests it is used. --- iOS_SDK/OneSignalSDK/Source/OneSignalFramework.h | 1 - 1 file changed, 1 deletion(-) diff --git a/iOS_SDK/OneSignalSDK/Source/OneSignalFramework.h b/iOS_SDK/OneSignalSDK/Source/OneSignalFramework.h index a1a2d557b..fd5f70c55 100755 --- a/iOS_SDK/OneSignalSDK/Source/OneSignalFramework.h +++ b/iOS_SDK/OneSignalSDK/Source/OneSignalFramework.h @@ -76,7 +76,6 @@ NS_SWIFT_NAME(login(externalId:token:)); + (Class)Notifications NS_REFINED_FOR_SWIFT; #pragma mark Initialization -+ (void)setLaunchOptions:(nullable NSDictionary*)newLaunchOptions; // meant for use by wrappers + (void)initialize:(nonnull NSString*)newAppId withLaunchOptions:(nullable NSDictionary*)launchOptions; + (void)setProvidesNotificationSettingsView:(BOOL)providesView;