You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OneSignal crashed at [OneSignalNotificationsUNUserNotificationCenter onesignalRequestAuthorizationWithOptions:completionHandler:] when I registered two Push SDKs.
Integration Code
- (void)registOneSignalNotifcation:(NSDictionary *)launchOptions {
// Remove this method to stop OneSignal Debugging
[OneSignal.Debug setLogLevel:ONE_S_LL_VERBOSE];
// OneSignal initialization
[OneSignal initialize:oneSignalKey withLaunchOptions:launchOptions];
// requestPermission will show the native iOS notification permission prompt.
// We recommend removing the following code and instead using an In-App Message to prompt for notification permission
[OneSignal.Notifications requestPermission:^(BOOL accepted) {
NSLog(@"User accepted notifications: %d", accepted);
} fallbackToSettings:true];
[OneSignal.Notifications addClickListener:self];
[self cleanBadgeNumber];
}
Steps to reproduce?
1. Integrate JPUSH SDK in AppDelegate
2. Integrate OneSignal SDK in AppDelegate
3. Crashed at OneSignalNotifications`__109-[OneSignalNotificationsUNUserNotificationCenter onesignalRequestAuthorizationWithOptions:completionHandler:]_block_invoke + 136
The reason for the crash is probably related to the below source code of OneSignal, I tried registering OneSignal first, but it still caused a crash of OneSignal. No crash of JPush SDK.
The reason we have 2 Push SDKs together is that we want to migrate from JPUSH to OneSignal SDK, we take the JPUSH SDK as a downgrade option for a while, then remove the JPUSH SDK.
OneSignalNotificationsUNUserNotificationCenter
+ (void)swizzleSelectors {
injectSelector(
[UNUserNotificationCenter class],
@selector(setDelegate:),
[OneSignalNotificationsUNUserNotificationCenter class],
@selector(setOneSignalUNDelegate:)
);
// Overrides to work around 10.2.1 bug where getNotificationSettingsWithCompletionHandler: reports as declined if called before
// requestAuthorizationWithOptions:'s completionHandler fires when the user accepts notifications.
injectSelector(
[UNUserNotificationCenter class],
@selector(requestAuthorizationWithOptions:completionHandler:),
[OneSignalNotificationsUNUserNotificationCenter class],
@selector(onesignalRequestAuthorizationWithOptions:completionHandler:)
);
injectSelector(
[UNUserNotificationCenter class],
@selector(getNotificationSettingsWithCompletionHandler:),
[OneSignalNotificationsUNUserNotificationCenter class],
@selector(onesignalGetNotificationSettingsWithCompletionHandler:)
);
}
### What did you expect to happen?
No crash.
### OneSignal iOS SDK version
Release 5.1.3
### iOS version
15
### Specific iOS version
```Markdown
iOS 17.4.1
@weiqingtangx Thank you for reaching out we will investigate the conflict. It looks like the JPush SDK is not open source (please correct me if I am wrong), but we will do our best to see how the SDKs are conflicting. Just to double check is the app not crashing if you remove either SDK?
@emawby Thank you for your reply. I investigated their official GitHub, it sounds like there is no source code of JPush iOS SDK. Our app is fine if we remove either SDK.
nan-li
changed the title
[Bug]: Crashed at [OneSignalNotificationsUNUserNotificationCenter onesignalRequestAuthorizationWithOptions:completionHandler:]
[Bug]: Using 2 push SDKs crashed at [OneSignalNotificationsUNUserNotificationCenter onesignalRequestAuthorizationWithOptions:completionHandler:]
Apr 16, 2024
What happened?
pod 'OneSignal/OneSignal', '5.1.3'
OneSignal crashed at [OneSignalNotificationsUNUserNotificationCenter onesignalRequestAuthorizationWithOptions:completionHandler:] when I registered two Push SDKs.
Integration Code
Steps to reproduce?
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: