Closed raphaels17 closed 10 months ago
Hello we appreciate feedback and are working on improving our migration guide. It sounds like you are migrating from the version 2 not version 3 since initWithLaunchOptions(launchOptions, appId: "my beautiful app id", handleNotificationReceived)
does not exist in version 3.
In version 3 we changed the notification events methods to:
setNotificationWillShowInForegroundHandler
and
setNotificationOpenedHandler
The notification received handler was renamed since that handler does not fire if the app has been killed. There is no OneSignal callback for a notification being received in the background unless it is opened.
Also noticed that some callbacks for the result state has been removed, for example OneSignal.setExternalUserId
with login()
, OneSignal.User.addTags
and etc. So just to clarify, OneSignal will not provide the result state anymore for those methods? thanks
Hi @emawby any update? Thanks
and also for https://documentation.onesignal.com/docs/data-tag-implementation#getting-tags, can't access it from the static User
instance.
Hi @michaelhenry that is correct, we removed callbacks to methods like login or addTags. The SDK now uses a system of caching and retrying that will persist through app cold starts.
The getTags method is added in release 5.0.5. Can you check your version?
@nan-li
how about the getDeviceState
? thanks
Hi @michaelhenry, the information returned in OSDeviceState
has been split up into their own sections. What piece of information are you looking for?
For example, if you are looking for the push subscription ID, it can be retrieved via OneSignal.User.pushSubscription.id
or if you're looking for what the native permission is, it is available via let permissionNative: OSNotificationPermission = OneSignal.Notifications.permissionNative
I am on OneSignal 5.0.5 , iOS17.2 Xcode 15 now and followed documentation for UNNotificationServiceExtension and but still i dont get how to get silent notification.
The document mention that i should get it in onwilldisplay and I have found in place to used func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void), none of it works
Basecally silent notification are not working
I do have this error in the console :
OneSignalNotificationServiceExtension[2071:220436] [User Defaults] Couldn't read values in CFPrefsPlistSource<0x10550cd60> (Domain: group.com.mybundle.onesignal, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd 2023-12-29 19:46:06.042835+0100 OneSignalNotificationServiceExtension[2071:220436] ERROR: OneSignal onNotificationReceived sendReceiveReceipt Failed for playerId: xyz error: (null)
I'm also trying to migrate from 3.11.2 to 5.1.5. With version 3.11.2 I could use setNotificationOpenedHandler What is the equivalent with 5.1.5?
What happened?
I am trying to migrate from 3. to 5.
this is how i used to initialize // handle notifications
`OneSignal.initWithLaunchOptions(aunchOptions, appId: "my beautiful app id", handleNotificationReceived: { (notification) in
now i see import OneSignalFramework
OneSignal.initialize("YOUR_ONESIGNAL_APP_ID", withLaunchOptions: launchOptions) on the doc OneSignal.Notifications.addForegroundLifecycleListener(self)
about handleNotificationReceived, handleNotificationAction and setting ?
In particular, I am afraid this will not work in the background any longer
Can anyone help ?
Steps to reproduce?
What did you expect to happen?
to have documentation for such change.
OneSignal iOS SDK version
5.0
iOS version
15
Specific iOS version
No response
Relevant log output
No response
Code of Conduct