on 2023 Jun 22 2:57 PM
Hallo,
we followed the integration example for iOS at https://help.emarsys.com/hc/de/articles/360004905078-iOS-integration-Mobile-Engage-iOS-SDK closely. That is, we created a Swift application, set up Emarsys as described and set the nofication delegate as described. The push token is also set.
In Emarsys, I can see all the SDK events, including the push token.
But now when I try to push a test message to the application, it is not received or shown. I tried a lot of things like setting up a contact and pushing the message only to the contact, setting up a segment for all iOS devices and pushing it to that, but unfortunately nothing helped.
Do you have an idea what could be wrong? Or is there even a fully working sample application?
Here is our code (application code and merchant id omitted):
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Perform custom app setup or configuration here
let config = EMSConfig.make { builder in
builder.setMobileEngageApplicationCode("....")
builder.setMerchantId("....")
builder.enableConsoleLogLevels([EMSLogLevel.trace, EMSLogLevel.debug, EMSLogLevel.info, EMSLogLevel.warn, EMSLogLevel.error, EMSLogLevel.basic])
}
Emarsys.setup(config: config)
// Handle push
UNUserNotificationCenter.current().delegate = Emarsys.push
// Example: Setting up a navigation bar appearance
let appearance = UINavigationBarAppearance()
appearance.backgroundColor = .blue
UINavigationBar.appearance().standardAppearance = appearance
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) {
(granted, error) in
if granted {
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
}
}
return true
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Emarsys.push.setPushToken(deviceToken)
}
}
Thanks,
Steven
Request clarification before answering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.