比较 OneSignal 的传统播放器模型(v3 和 v4)与现代用户模型(v5+)之间的方法和属性名称,提供并排的 Swift 代码示例以简化迁移。
initWithLaunchOptions()
setLogLevel()
setExternalId()
removeExternalUserId()
sendTag()
sendTags()
getTags()
deleteTag()
deleteTags()
notificationPermissionStatus
userId
hasNotificationPermission()
/ areNotificationsEnabled
pushToken
hasNotificationPermission
isSubscribed
[已弃用]isPushDisabled
[已弃用]setLanguage()
setRequiresUserPrivacyConsent()
consentGranted()
setLocationShared()
isLocationShared()
promptLocation()
addSubscriptionObserver()
removeSubscriptionObserver()
promptForPushNotifications()
postNotification()
[已弃用]clearOneSignalNotifications()
disablePush()
unsubscribeWhenNotificationsAreDisabled()
[已弃用]setLaunchURLsInApp()
[已弃用]registerForProvisionalAuthorization()
setNotificationWillShowInForegroundHandler()
setNotificationOpenedHandler()
addPermissionObserver()
removePermissionObserver()
enterLiveActivity()
exit()
addTrigger()
addTriggers()
removeTriggerForKey()
removeTriggerForKeys()
getTriggerValueForKey()
[已弃用]inAppMessagesArePaused
setInAppMessageLifecycleHandler()
setInAppMessageClickHandler()
setEmail()
logoutEmail()
setSMSNumber()
addSMSSubscriptionObserver()
[已弃用]getSMSId()
[已弃用]sendOutcome()
sendOutcomeWithValue()
sendUniqueOutcome()