sefidgaran / salesforce-marketing-cloud

Salesforce Marketing Cloud MobilePush Flutter SDK
https://pub.dev/packages/sfmc_plugin
MIT License
6 stars 21 forks source link

iOS app push notification link issue while app is closed #2

Closed sefidgaran closed 1 year ago

sefidgaran commented 1 year ago

Existed issue regarding iOS:

1. Given iOS app is not running (closed) 
2. When push notification received
3. And user tap on notification carring a link
4. sfmc_handle not called!

Pull requests OR solution to this issue are welcomed. Thanks in advance

sefidgaran commented 1 year ago

Update: After investigating more and test the official learning app from Salesforce 7.6, same issue observed, so this issue looks like a SFMC SDK issue. Any updates are welcomed. Thanks

sefidgaran commented 1 year ago

Update: After migrating Marketing Cloud SDK iOS to version 8.0.8 and SFMCSdk 1.0.6, I managed to fix this issue. Now in iOS when app is killed, URL in push notification will be received.

So, issue resolved.

ifelsebreak commented 7 months ago

We are experiencing the same behaviour. Even with the latest version of sfmc_plugin, the url handler isn't called when the app is in terminated state. Tapping the notification opens the app on the home page.

SimonLauridsen commented 5 months ago

I'm experiencing the same issue - and I'm running version 8.0.13. @sefidgaran Did you do something speciel to make it work? Or did it just work out of the box all of a sudden?

lucasgarcez-bilue commented 5 months ago

I'm facing the same issue with my React Native App. useng the react-native-marketingcloudsdk that wraps the iOS SDK. I have the sfmc_handleURL implemented on the AppDelegate.mm,, and it calls on a push notification is opened with the App in the background, but it doesn't happen if the App is closed. The notification takes the user to the Home Screen and doesn't call the sfmc_handleURL.

fernandosev commented 3 months ago

Works fine after adding the follow code on AppDelegate.mm > -(BOOL)application.

Obs.: After MKC configuration

if (newLaunchOptions != nil && [newLaunchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey] != nil) {
          NSDictionary *userInfo = [newLaunchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
          [[SFMCSdk mp] setNotificationUserInfo:userInfo];

        if (userInfo[@"_od"]) {
            NSString *initialURL = userInfo[@"_od"];
            if (!newLaunchOptions[UIApplicationLaunchOptionsURLKey]) {
              newLaunchOptions[UIApplicationLaunchOptionsURLKey] = [NSURL URLWithString:initialURL];
            }
        }
      }