Firebase swift dynamic link twice - ios

Im having a issue with Firebase and Dynamic Links.
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool
is triggered more than once.
For example after using the dynamic link on the device - the app opens and "open url" is called. Then i delete the app, reinstall and the "open url" is triggered again with the dynamic link.
Any idea why this could be happening?
Is maybe issue correlated with this similar problem on android?
Firebase dynamic links handled twice

Related

How to check if the app had opened by clicking a universal link or not in the didFinishLaunchingWithOptions method

currently I'm working on a swift project. Here I implemented deep linking using universal link for verify my email address. And it's working fine. What I need is how to check whether if the app is opened by clicking the universal link or not. Because in the didFinishLaunchingWithOptions method, I'm checking like whether the user is already logged in or not. And if the user is logged in I'm navigating to the home screen else navigating to the login screen. And the checking is happening in the
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
method. And when I click the universal link I also get the callback in
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: #escaping ([Any]?) -> Void) -> Bool
method. And in this method i'm navigating to email verification screen
But the problem is when I click the universal link, it open my app and its navigating to the login screen(because the user is not logged in) and then immediately navigating the email verification screen. Actually, what I need is I don't what to navigate to the login screen or home screen if I came to the app by clicking the universal link. Please help me.
You can try checking the launchOptions available in didFinishLaunchingWithOptions delegate for the key
UIApplicationLaunchOptionsURLKey
A key indicating that the app was
launched so that it could open the specified URL.
When opens with deep linking below method triggers in AppDelegate
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool {
//Enter Logic Here based on your URL
}

Gigya Swift Facebook and Google Native login

I am integrating gigya facebook and google to my app. The login process works when using webview, but i am having problems when i use the native apps.
For facebook, i am able to open the native app and it proceeds all the way to the screen where it says "You previously logged in with...", but upon clicking continue, it just returns to the screen where it prompts you to choose between using the facebook app or not.
For google, i have downloaded the Google app into my iOS device. But it is still using the webview with no way to use the Google app.
I am using GigyaSwift v1.0.1. Google and Facebook Wrapper is included in my Compile sources.
I have configured the following ID's into my app:
Basically GigyaSwift using GoogleSign-In SDK and it open the webView, Also you can see the implementation at GoogleWrapper.swift file.
For facebook, i apparently forgot to input some code in my AppDelegate to handle the return from Facebook native app to my app.
This is the code:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
//insert other code here
ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return ApplicationDelegate.shared.application(app, open: url, sourceApplication: options[.sourceApplication] as? String, annotation: options[.annotation])
}
For Google #Sagi Shmuel was right. Opening of Webview is the expected behavior. Thanks!

Facebook iOS App Login fails with "Session Expired" when user is not logged into the Facebook App

I have an iOS app that uses Facebook iOS Swift SDK for login. The flow is:
User clicks the login button on the app
User is redirected to the Facebook App
User logs in to the app
User is redirected back to the app when the login is successful
The above works fine when the user is already signed in to the Facebook App. However, if the user is not signed in the Facebook app and sign's in as step 3 of this workflow, the login fails with "Session Expired", "File Can't Be Opened" "This file type is unsupported"
Has anyone seen this error before? What could be causing this?
Tried this on multiple devices with the same issue. It does work on the first install but then the state somehow gets messed up and I get the same error on subsequent logins.
Code for integration with Facebook is as follows:
App Delegate application did finish launching with options call to SDK App Delegate
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
SDKApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
}
Open URL call to SDK App Delegate
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return SDKApplicationDelegate.shared.application(app, open: url, options: options)
}
Facebook Login Button
self.loginButton = LoginButton(readPermissions: [.userFriends, .email, .publicProfile])
self.loginButton!.delegate = AppLoginButtonDelegate() // App's Login Button Delegate
self.loginStackView!.addSubview(self.loginButton!)
I've run into the same issue in our project.
Updating the Facebook App on our device resolved the issue.

Branch.io (deep link activity) not working on iOS12 swift?

We have implemented the deep link activity in our application. It worked in iOS 11. When we send SMS via a web portal. Its received in iPhone. After updated into iOS 12 the link messages are not received for my iPhone devices. Here is my code below:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let branch: Branch = Branch.getInstance()
branch.initSession(launchOptions: launchOptions, automaticallyDisplayDeepLinkController: true, deepLinkHandler: { params, error in
if error == nil {}}
// Respond to URI scheme links
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
Branch.getInstance().handleDeepLink(url);
return true
}
we have added branch_app_domain, branch_key and URL Type in plist also.
Do we need to add anything in my code ??
After updating a device to iOS 11.2+,the app's AASA file is no longer downloaded reliably onto your user’s device after an app install. As a result, clicking on Universal Links will no longer open the app consistently. You can set forced uri redirect mode on your Branch links to open the app with URI schemes. View details of the issue on the Apple Bug report.
For any further questions, please write to integrations#branch.io.

How to get the caller's info When a app using URL Scheme to open my App in iOS

In my situation, a third-party app will using URL Scheme to open my App in iOS, but my App must get some information about the caller, like caller's app name, caller's app icon.
How to do this ? or Is there another way to solve the situation?
If you implement openURL in your AppDelegate, you can get some of those value, app icon is not possible though, you have to prepare it yourself or the scheme must somehow have it as url/data:
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
print("source \(sourceApplication)")
print("scheme \(url.scheme)")
print("query \(url.query)")
print("full \(url.absoluteString)")
}
iOS can bind your app and a custom URL Scheme. With this URL Scheme you can
launch your app from browser or other app.
You create the URL Scheme like snapshot:
URL Scheme: myapp
URL identifier: com.ypd.myapp
Then you can send URL like this below:
myapp://
myapp://example/path/here
myapp://?param1=1&param2=2
myapp://some/path/here?param1=1&param2=2
From the delegate method, you can get the deliver data:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
// Do something with the url here
}

Resources