Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with uniLinks #28

Open
vizakenjack opened this issue Jul 29, 2023 · 4 comments
Open

Conflict with uniLinks #28

vizakenjack opened this issue Jul 29, 2023 · 4 comments

Comments

@vizakenjack
Copy link

vizakenjack commented Jul 29, 2023

Thanks for your package! I used flutter_apns and have tried to migrate to Push. It works fine, but I got one annoying issue.

I use uni_links with this code to start the app with an initial link:

final initialUri = await getInitialUri();
openUri(initialUri);

It works fine when I use flutter_apns, but it stops working right after I add Push to pubspec.yaml.
Please note that it only affects the initial start, when the app was terminated.

Is there any ideas how can I fix it?

I also tried https://pub.dev/packages/app_links instead of uni_links, but still was not able to get initial url.

@kaiquegazola
Copy link
Contributor

kaiquegazola commented Aug 9, 2023

It also happens with my app using firebase_dynamic_links on iOS. It doesn't seem to happen on Android for me.

In my investigation, it appears that the issue is related to returning false in the delegate didFinishLaunchingWithOptions. When returning true, everything seems to work normally.

https://github.com/ben-xD/push/blob/0b0ce07c268a5b487a4cd784443abd86eb834e92/push_ios/ios/Classes/SwiftPushPlugin.swift#L21-L30C6

@nikolaydimitrov
Copy link

@kaiquegazola is correct, I had to fork and change that return statement, and do this in pubspec.yaml to work around it:

dependency_overrides:
  push_ios:
    git:
      url: https://github.com/circled-me/push-plugin.git
      ref: 9d2bf81
      path: push_ios

@olivierbrand
Copy link

I just opened a PR for the return statement.

@KKranjcevic
Copy link

KKranjcevic commented Feb 21, 2024

The problem is with every universal link package(uni_links, go_router, ...). When the app is terminated (iOS) the links dont work.

Apple docs:
https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623072-application

application(_:continue:restorationHandler:) - Tells the delegate that the data for continuing an activity is available.
This method isn't called if either application(_:willFinishLaunchingWithOptions:) or application(_:didFinishLaunchingWithOptions:) returns false.

To make the univesal links work in iOS in your ios/AppDelegate.swif file

replace:
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
with
`let _ = super.application(application, didFinishLaunchingWithOptions: launchOptions)

return true`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants