Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS App Crashes After Push Notification Permission #577

Closed
ibrahimdevs opened this issue Jul 22, 2022 · 2 comments
Closed

iOS App Crashes After Push Notification Permission #577

ibrahimdevs opened this issue Jul 22, 2022 · 2 comments

Comments

@ibrahimdevs
Copy link

ibrahimdevs commented Jul 22, 2022

Hi,

Because of plugin's swizzling mechanism I'm getting crash error. I'm asking push notification permission request. When user click "Allow" for push permission, my app is crashing randomly, not every time. I'm getting this error on iOS devices.

My flutter version 3.0.5 and dart 2.17.6. I'm using adapty_flutter 1.0.12 and onesignal_flutter 3.3.2. This error comes from one of them but I'm not sure which one.

Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_PROTECTION_FAILURE 0x000000016f513fd0

Crashed: com.apple.main-thread
0 libicucore.A.dylib 0xb3938 icu::UnicodeString::copyFrom(icu::UnicodeString const&, signed char) + 4
1 libicucore.A.dylib 0x17e200 icu::number::LocalizedNumberFormatter::getDecimalFormatSymbols() const + 956
2 libicucore.A.dylib 0x18c2ec icu::number::impl::ImmutablePatternModifier::processQuantity(icu::number::impl::DecimalQuantity&, icu::number::impl::MicroProps&, UErrorCode&) const + 76
3 libicucore.A.dylib 0x17ed04 icu::number::LocalizedNumberFormatter::getDecimalFormatSymbols() const + 3776
4 libicucore.A.dylib 0x17ebf4 icu::number::LocalizedNumberFormatter::getDecimalFormatSymbols() const + 3504
5 libicucore.A.dylib 0x17d84c icu::number::LocalizedNumberFormatter::formatImpl(icu::number::impl::UFormattedNumberData*, UErrorCode&) const + 112
6 libicucore.A.dylib 0x1ed1c0 icu::SimpleDateFormat::zeroPaddingNumber(icu::NumberFormat const*, icu::UnicodeString&, int, int, int) const + 756
7 libicucore.A.dylib 0x1eb8c4 icu::SimpleDateFormat::subFormat(icu::UnicodeString&, char16_t, int, UDisplayContext, int, char16_t, icu::FieldPositionHandler&, icu::Calendar&, UErrorCode&) const + 1668
8 libicucore.A.dylib 0x1eb05c icu::SimpleDateFormat::_format(icu::Calendar&, icu::UnicodeString&, icu::FieldPositionHandler&, UErrorCode&) const + 520
9 libicucore.A.dylib 0x1eae34 icu::SimpleDateFormat::format(icu::Calendar&, icu::UnicodeString&, icu::FieldPosition&) const + 84
10 libicucore.A.dylib 0x116770 icu::DateFormat::format(double, icu::UnicodeString&, icu::FieldPosition&) const + 176
11 libicucore.A.dylib 0x220760 udat_format + 352
12 CoreFoundation 0x3ebb8 __cficu_udat_format + 68
13 CoreFoundation 0x4ca18 CFDateFormatterCreateStringWithAbsoluteTime + 172
14 CoreFoundation 0xaddec -[NSDate descriptionWithLocale:] + 496
15 Foundation 0x1cb04 _NSDescriptionWithLocaleFunc + 68
16 CoreFoundation 0x9b8c __CFStringAppendFormatCore + 11120
17 CoreFoundation 0x2898c CFStringCreateWithFormatAndArgumentsReturningMetadata + 176
18 Foundation 0x19f30 +[NSString stringWithFormat:] + 76
19 OneSignal 0xfae0 +[OneSignal shouldRegisterUserAfterDelay] + 164
20 OneSignal 0xf974 +[OneSignal registerUser] + 72
21 OneSignal 0xf1a4 +[OneSignal updateDeviceToken:] + 296
22 OneSignal 0x12bf4 +[OneSignal didRegisterForRemoteNotifications:deviceToken:] + 228
23 OneSignal 0x2e744 -[OneSignalAppDelegate oneSignalDidRegisterForRemoteNotifications:deviceToken:] + 136
24 Adapty 0x21848 $s6Adapty19AppDelegateSwizzlerC20swizzled_application33_882DEC7821489E8AC05D52AA1ADD858BLL_48didRegisterForRemoteNotificationsWithDeviceTokenySo13UIApplicationC_10Foundation4DataVtFTf4nnd_n + 180
25 Adapty 0x21720 $s6Adapty19AppDelegateSwizzlerC20swizzled_application33_882DEC7821489E8AC05D52AA1ADD858BLL_48didRegisterForRemoteNotificationsWithDeviceTokenySo13UIApplicationC_10Foundation4DataVtFTo + 92
26 CoreFoundation 0x21b24 invoking
+ 148
27 CoreFoundation 0x3f610 -[NSInvocation invoke] + 468
28 OneSignalCore 0x4984 +[SwizzlingForwarder callSelector:onObject:withArgs:] + 312
29 OneSignal 0x2e7b4 -[OneSignalAppDelegate oneSignalDidRegisterForRemoteNotifications:deviceToken:] + 248
30 UIKitCore 0xf6953c __63-[UIApplication pushRegistry:didUpdatePushCredentials:forType:]_block_invoke + 180
31 libdispatch.dylib 0x1e6c _dispatch_call_block_and_release + 92
32 libdispatch.dylib 0x3a30 _dispatch_client_callout + 148
33 libdispatch.dylib 0x11f48 _dispatch_main_queue_drain + 468
34 libdispatch.dylib 0x11b98 _dispatch_main_queue_callback_4CF + 312
35 CoreFoundation 0x51800 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 248
36 CoreFoundation 0xb704 __CFRunLoopRun + 180
37 CoreFoundation 0x1ebc8 CFRunLoopRunSpecific + 92
38 GraphicsServices 0x1374 GSEventRunModal + 148
39 UIKitCore 0x514648 -[UIApplication _run] + 468
40 UIKitCore 0x295d90 UIApplicationMain + 312
41 Runner 0x58c8 main + 7 (AppDelegate.swift:7)
42 ??? 0x100fa5ce4 $s6Adapty19AppDelegateSwizzlerC20swizzled_application33_882DEC7821489E8AC05D52AA1ADD858BLL_48didRegisterForRemoteNotificationsWithDeviceTokenySo13UIApplicationC_10Foundation4DataVtFTf4nnd_n + 180

@jkasten2
Copy link
Member

jkasten2 commented Jul 22, 2022

@ibrahimdevs Thanks for reporting with the full stack trace.

From this part of the stacktrace it looks like the following is getting called OneSignal -> Adapty -> OneSignal, as I see OneSignalAppDelegate oneSignalDidRegisterForRemoteNotifications:deviceToken: in their twice.

23 OneSignal 0x2e744 -[OneSignalAppDelegate oneSignalDidRegisterForRemoteNotifications:deviceToken:] + 136
24 Adapty 0x21848 $s6Adapty19AppDelegateSwizzlerC20swizzled_application33_882DEC7821489E8AC05D52AA1ADD858BLL_48didRegisterForRemoteNotificationsWithDeviceTokenySo13UIApplicationC_10Foundation4DataVtFTf4nnd_n + 180
25 Adapty 0x21720 $s6Adapty19AppDelegateSwizzlerC20swizzled_application33_882DEC7821489E8AC05D52AA1ADD858BLL_48didRegisterForRemoteNotificationsWithDeviceTokenySo13UIApplicationC_10Foundation4DataVtFTo + 92
26 CoreFoundation 0x21b24 invoking + 148
27 CoreFoundation 0x3f610 -[NSInvocation invoke] + 468
28 OneSignalCore 0x4984 +[SwizzlingForwarder callSelector:onObject:withArgs:] + 312
29 OneSignal 0x2e7b4 -[OneSignalAppDelegate oneSignalDidRegisterForRemoteNotifications:deviceToken:] + 248
30 UIKitCore 0xf6953c __63-[UIApplication pushRegistry:didUpdatePushCredentials:forType:]_block_invoke + 180

Does Adapty provide support for push notifications? It seems it is also trying to get the pushToken but I am not sure why as from a quick look it seems Adapty doesn't have a push feature.

I see [UIApplication pushRegistry:didUpdatePushCredentials:forType:] in the stack trace. This is a PushKit method for supporting VoIP notifications. Are you using another plugin to support this?

@ibrahimdevs
Copy link
Author

@jkasten2 thanks for quick response.

Yes, Adapty provides support for push notifications. For example; you can send push notifications when a user cancelled subscription. Or you can provide hidden paywall with only behind push notification.

I see [UIApplication pushRegistry:didUpdatePushCredentials:forType:] in the stack trace. This is a PushKit method for supporting VoIP notifications. Are you using another plugin to support this?

I'm not using this VoIP notifications at least on purpose. Searched it on my project but I can't find which plugin uses it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants