Good morning,

I am having issues in my iOS APP when trying to register for remote notifications using the SFMC Swift SDK:

sfmc-sdk-ios v1.1.0 MarketingCloudSDK-iOS v8.1.0

The steps I am following are:

  1. Initialize the SDK

     func configureSdk() -> Bool {
     // To Override the Keychain Error to be considered fatal or not (Default value is true)
     SFMCSdk.setKeychainAccessErrorsAreFatal(errorsAreFatal: false)
     let mobilePushConfiguration = PushConfigBuilder(appId: Configuration.shared.data.sfmcAppId)
         .setMarketingCloudServerUrl(URL(string: Configuration.shared.data.sfmcAppEndpoint)!)
     let completionHandler: (OperationResult) -> Void = { result in
         if result == .success {
     SFMCSdk.initializeSdk(ConfigBuilder().setPush(config: mobilePushConfiguration, onCompletion: completionHandler).build())
     return true


  2. Request authorization, which is called in the completionHandler of the SDK registration.

  3. Register for remote notifications, called when the authorization has been granted:

     func setupMobilePush() {
     DispatchQueue.main.async {
         UNUserNotificationCenter.current().delegate = self
         UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge], completionHandler: {(_ granted: Bool, _ error: Error?) -> Void in
             if error == nil {
                 Configuration.shared.data.sfmcNotificationPermissionGranted = granted
                 if granted && !SFMCSdk.mp.pushEnabled() {
                 } else if !granted && SFMCSdk.mp.pushEnabled() {
                 self.taskPutPushEnabled = Task { @MainActor [weak self] in
                     do {
                         try await self?.notificationUseCase.putPushEnabled()
                     } catch {
                     self?.taskPutPushEnabled = nil
                 DispatchQueue.main.async {
                     print("*** ALLOW NOTIFICATIONS: \(granted)")


However, I am not receiving the mobile push notifications. When trying to find my device in the Dashboard, I can see that I am not Opted In, and the Opt Out Method is "Missing or invalid Device Token".

Missing or invalid Device Token

I have no clue where the problem may be, I think the setup is correct. Anyone has faced the same issue?

1 Answer 1


Please check the environment in which the app is built (ie) either production or sandbox environment and point the same in the MC UI.

You can check the environment using the script in send a test push from https://salesforce-marketingcloud.github.io/MarketingCloudSDK-iOS/trouble/ios-debugging.html (note: "endpoint" in the script is pointed to apple's sandbox environment. Please point to production api.push.apple.com server to test on prod environment.)

Thanks, Prakashini

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .