OneSignal / react-native-onesignal

React Native Library for OneSignal Push Notifications Service
Other
1.57k stars 373 forks source link

[Crash] OneSignalUserDefaults getSavedCodeableDataForKey:defaultValue #1249

Closed Ahmed-Imam closed 3 years ago

Ahmed-Imam commented 3 years ago

Description: App crashes on some devices upon updating.

Environment react-native: v0.63.4 react-native-onesignal : v3.8.0 oneSignal SDK: v2.14.3 ios: v14.4.2

Steps to Reproduce Issue: Replicated on production only

Crash logs

Fatal Exception: NSInvalidArgumentException 0 CoreFoundation 0x191a5186c exceptionPreprocess 1 libobjc.A.dylib 0x1a6a6ac50 objc_exception_throw 2 CoreFoundation 0x19195895c -[NSOrderedSet initWithSet:copyItems:] 3 CoreFoundation 0x191a54438 forwarding 4 CoreFoundation 0x191a56740 _CF_forwarding_prep_0 5 Foundation 0x192c7ecc8 -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:] 6 Foundation 0x192ccbff4 -[NSKeyedUnarchiver initForReadingWithData:] 7 Foundation 0x192ccc618 +[NSKeyedUnarchiver unarchiveObjectWithData:] 8 happyseason 0x1009b4a48 -[OneSignalUserDefaults getSavedCodeableDataForKey:defaultValue:] 9 happyseason 0x100980f30 -[OSMessagingController init] 10 happyseason 0x100980bcc 39+[OSMessagingController sharedInstance]_block_invoke 11 libdispatch.dylib 0x191645db0 _dispatch_client_callout 12 libdispatch.dylib 0x1916475c8 _dispatch_once_callout 13 happyseason 0x100980b8c +[OSMessagingController sharedInstance] 14 happyseason 0x10097ae54 +[OneSignal receivedInAppMessageJson:] 15 happyseason 0x1009a8338 +[OneSignalTracker applicationForegrounded] 16 happyseason 0x1009a2f78 -[OneSignalAppDelegate oneSignalApplicationDidBecomeActive:] 17 UIKitCore 0x194401e2c -[UIApplication _stopDeactivatingForReason:] 18 UIKitCore 0x193a612a0 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] 19 UIKitCore 0x193a6161c -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] 20 UIKitCore 0x193a60e58 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] 21 UIKitCore 0x193a693a4 186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke 22 UIKitCore 0x193edb60c +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] 23 UIKitCore 0x193fe76c4 _UISceneSettingsDiffActionPerformChangesWithTransitionContext 24 UIKitCore 0x193a6909c -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] 25 UIKitCore 0x1938905a0 64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke 26 UIKitCore 0x19388ef14 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] 27 UIKitCore 0x1938901c8 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] 28 UIKitCore 0x193f052e8 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] 29 FrontBoardServices 0x1a17bac94 -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] 30 FrontBoardServices 0x1a17e7504 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 31 FrontBoardServices 0x1a17c94a0 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] 32 FrontBoardServices 0x1a17e7430 94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke 33 libdispatch.dylib 0x191645db0 _dispatch_client_callout 34 libdispatch.dylib 0x191649738 _dispatch_block_invoke_direct 35 FrontBoardServices 0x1a180e250 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK 36 FrontBoardServices 0x1a180dee0 -[FBSSerialQueue _targetQueue_performNextIfPossible] 37 FrontBoardServices 0x1a180e434 -[FBSSerialQueue _performNextFromRunLoopSource] 38 CoreFoundation 0x1919cd76c CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION 39 CoreFoundation 0x1919cd668 CFRunLoopDoSource0 40 CoreFoundation 0x1919cc960 CFRunLoopDoSources0 41 CoreFoundation 0x1919c6a8c CFRunLoopRun 42 CoreFoundation 0x1919c621c CFRunLoopRunSpecific 43 GraphicsServices 0x1a9590784 GSEventRunModal 44 UIKitCore 0x194406ee8 -[UIApplication _run] 45 UIKitCore 0x19440c75c UIApplicationMain 46 happyseason 0x10057b688 main + 18 (AppDelegate.swift:18) 47 libdyld.dylib 0x1916866b0 start

Ahmed-Imam commented 3 years ago

@rgomezp I believe this issue has been addressed in the release v2.16.4 based on this comment but the latest react-native-onesignal release that depends on v2 of ios sdk which is v3.9.3 is using v2.16.1. will v3.9.3 work fine with v2.16.4 if we will just patch the version in podspec to v2.16.4 ? Thanks

Ahmed-Imam commented 3 years ago

@jkasten2 @Jeasmine any thoughts on this ? thanks

spirit-jsb commented 3 years ago

we have the same crash.

cache log

Fatal Exception: NSInvalidArgumentException 0 CoreFoundation 0x19a0af298 exceptionPreprocess 1 libobjc.A.dylib 0x1ade09480 objc_exception_throw 2 CoreFoundation 0x19a11aaf4 -[NSCFString characterAtIndex:].cold.1 3 CoreFoundation 0x19a07a774 _CFPrefsValidateValueForKey 4 CoreFoundation 0x19a07ae14 createDeepCopyOfValueForKey 5 CoreFoundation 0x19a07ab24 -[CFPrefsSource setValues:forKeys:count:copyValues:removeValuesForKeys:count:from:] 6 CoreFoundation 0x19a07af34 -[CFPrefsSource setValues:forKeys:count:copyValues:from:] 7 CoreFoundation 0x199f9a0f8 -[CFPrefsSource setValue:forKey:from:] 8 CoreFoundation 0x19a107084 76-[_CFXPreferences setValue:forKey:appIdentifier:container:configurationURL:]_block_invoke 9 CoreFoundation 0x19a0cbbd4 108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke 10 CoreFoundation 0x19a0cb2c0 normalizeQuintuplet 11 CoreFoundation 0x19a0cba48 -[_CFXPreferences withSearchListForIdentifier:container:cloudConfigurationURL:perform:] 12 CoreFoundation 0x199f99bac -[_CFXPreferences setValue:forKey:appIdentifier:container:configurationURL:] 13 CoreFoundation 0x19a10a57c _CFPreferencesSetAppValueWithContainerAndConfiguration 14 Foundation 0x19b2bb55c -[NSUserDefaults(NSUserDefaults) setObject:forKey:] 15 Lit Live 0x1004b5dbc -[OneSignalUserDefaults saveDictionaryForKey:withValue:] 16 Lit Live 0x1004818a4 -[OSMessagingController deleteOldRedisplayedInAppMessages] 17 Lit Live 0x100499c78 +[OneSignal receivedInAppMessageJson:] 18 Lit Live 0x10049971c 33+[OneSignal registerUserInternal]_block_invoke 19 libdispatch.dylib 0x199ce62b0 _dispatch_call_block_and_release 20 libdispatch.dylib 0x199ce7298 _dispatch_client_callout 21 libdispatch.dylib 0x199cc9430 _dispatch_main_queue_callback_4CF$VARIANT$armv81 22 CoreFoundation 0x19a02e2e0 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE 23 CoreFoundation 0x19a028740 CFRunLoopRun 24 CoreFoundation 0x19a027818 CFRunLoopRunSpecific 25 GraphicsServices 0x1b072d570 GSEventRunModal 26 UIKitCore 0x19c9530e8 -[UIApplication _run] 27 UIKitCore 0x19c958664 UIApplicationMain 28 Lit Live 0x1001c0bc0 main + 14 (AppDelegate.swift:14) 29 libdyld.dylib 0x199d06140 start

Ahmed-Imam commented 3 years ago

@spirit-jsb I am not sure if its the same issue as ours, but if it is, the issue was fixed on v2.16.4 ios SDK, if you are in react native, u should use react-native-onesignal-v3.9.3 and do patching on node_module/react-native-onesignal-v3.9.3 to use v2.16.4 instead of v2.16.1.

Ahmed-Imam commented 3 years ago

u can also use react-native-onesignal v3.9.4 since it has been released already and its uses iOS sdk 2.16.5.

rgomezp commented 3 years ago

It sounds like this issue is safe to close. Is there anything else?