I try to implement App Link in my IOS project. I've setup URL Schemes, and tested by typing testApps:// into mobile safari. Open apps dialog is prompt.
Im also setup a html file, access by public domain, www.testSite.com/testApps.html and include basic meta tag recommend by most Apps Link tutorial website. The file is shown as below:
<html>
<head>
<meta property="al:ios:url" content="testApps://default" />
<meta property="al:ios:app_name" content="testApps" />
</head>
</html>
However, safari do not prompt to open Apps when i key in the URL.
I also setup facebook apps setting, FB_test_Apps, set URL Scheme Suffix to be testApps, turn on Single sign on and Deep Linking.
I share www.testSite.com/testApps.html in facebook, and also from apps which register under facebook apps FB_test_Apps (which it will show as "Via FB_test_Apps" under the post).
When i click on this two post, Facebook will load it in facebook's webview. However it do not prompt to open my apps as well.
Is there anything i've missed out?
Update
I found out this issue only happen in IOS9. iOS 8 able to work well.
Regard
Steven
Yes iOS 9 has made some changes. You need to whitelist the url schemes you're using in your project.
Just add LSApplicationQueriesSchemes of type array in your info-plist and mention the urls you need to open in your project under it.
I guess too late to the party.
As mentioned above by Bhavuk, you have to white list the fb app for iOS9 and up.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fb</string>
<string>fbapi</string>
<string>fbauth2</string>
<string>fbshareextension</string>
<string>fb-messenger-api</string>
</array>
Referring from here.
iOS 9 not opening Instagram app with URL SCHEME
Related
I am trying to implement deep linking in my flutter app. I am using the uni_links flutter package.
I am sending the deeplink for my application to the user's email account. However, in gmail, you need the http protocol in the href value, Otherwise gmail will not consider that as a valid link. Hence I am forced to use the following link in the email :
Click here
as opposed to a link like,
Click here
Now with https://myexample.flutter.dev, when I open the link from gmail, it doesn't open my app.
But, if I change my CFBundleURLSchemes key to myexample and CFBundleURLName to flutter.dev, when I type in myexample://flutter.dev in my browser, it opens my app. However, like I mentioned before, this is not recognized as a valid link in gmail.
What is the issue here? How do I resolve this?
Here's my ios/Runner/Info.plist :
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>myexample.flutter.dev</string>
<key>CFBundleURLSchemes</key>
<array>
<string>https</string>
</array>
</dict>
</array>
The first one is custom link you can do it by yourself
Click here
The second one is universal link
You need to provide file on the backend side to make it work.
Universal Links only work with https scheme and require a specified host, entitlements and a hosted file - apple-app-site-association.
Click here
UniversalLinksDocumentation
PS. I think right now as the end of the 2020 the best way to handle deeplinks is by Firebase Dynamic Links. Maybe future people will consider it it should be much more easier
I'm currently using a custom URL scheme to allow users to access my app (say, FoobarApp) from custom links (foobar://resource/42).
I set up the scheme like so :
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.acme.foobarapp</string>
<key>CFBundleURLSchemes</key>
<array>
<string>foobar</string>
</array>
</dict>
</array>
This works well when the users click the link in Safari.
Now I'd like them to be able to click said links in third-party apps (in my case Trello), to open my app.
This does not work, as the system (since iOS 9 if I'm not mistaken) now requires that apps whitelist URL scheme they want to query (with the LSApplicationQueriesSchemes in Info.plist).
(This is the message I get in the logs when I click the link in the third-party app:
iPad Trello(UIKit)[2368] : -canOpenURL: failed for URL: "foobar://resource/42" - error: "This app is not allowed to query for scheme foobar"
)
It's not reasonable to expect the third-party app to add my (enterprise) app's scheme to their LSApplicationQueriesSchemes list. Is their any option to "bypass" this protection? A kind of way to tell the system "It's fine, Trello can open my app"?
Summary
Custom app links foobar:// work in Safari
They don't work in third-party app (nothing happens, see log a few lines up)
How can I whitelist third-party apps so they can open my app?
an app has to tell ios it wants to query a url scheme. It has to declare this in its info plist at compile time!
There is no way around this on a apple allowed iPhone.
Sure when you jailbreak a phone, all can be done but... thats not a valid assumption either ;)
a workaround may be to link to a Website via HTTP and have the user open the app from there.
I'm trying to create call-to-action button that will open my app.
What I've done:
1 . Added url scheme to my up.
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>myapp</string>
</array>
<key>CFBundleURLName</key>
<string>com.myid.myapp</string>
</dict>
</array>
2 . Added metadata to my website.
<meta property="al:ios:url" content="myapp://open"/>
<meta property="al:ios:app_store_id" content="12345"/>
<meta property="al:ios:app_name" content="My App"/>
3 . Added a link with the deeplink on my site. It works great and launches my app.
Run the app
4 . Added call-to-action button on my facebook page, filled al the fields with:
web-site: url to my website;
ios deeplink: myapp://open;
app store url: app store url;
But clicking on the call-to-action button always leads to appstore.
https://developers.facebook.com/docs/applinks don't answer some questons:
How does facebook know that metadata locates on my website? I mean, when facebook searches for metadata, how does it know that it must search on my website?
If Facebook just opens deeplink, why doesnot it open my app?
I was able to open apps from safari this way:
window.location = 'myapp://do/xx';
or open facebook app:
window.location = 'fb://';
But this stopped working in iOS9.
How can I open apps using URL schemes in safari?
IOS 9 URL Shchemes Update :
iOS 9 introduces LSApplicationQueriesSchemes to allow apps to query if other apps are installed.
1- If a url scheme is declared and calling canOpenURL(scheme)
YES if a installed app supports that URL scheme
NO if no app supporting that url
syslog will show canOpenURL: failed for URL: "urlScheme://" - error: null
2- If a url scheme is not declared and calling canOpenURL(scheme)
always return NO
syslog will show canOpenURL: failed for URL: "urlScheme://" - error: null
In iOS 9, the developer must add these info.plist
LSApplicationQueriesSchemes
<array>
<string>urlscheme</string>
<string>urlscheme2</string>
<string>urlscheme3</string>
<string>urlscheme4</string>
</array>
50 max. unqiue URL scheme can be declared!
With iOS9, Apple is changing a few things concerning URL schemes. Here is an article about those changes.
Basically, you now have to register all URL schemes that are supported by your app in your .plist file.
With the general release of ios9 setting window.location to a custom url does launch the app, but only after the user hits open in a popup. I filed a bug with apple about this, and they responded saying that it was intended behavior for launching an app from safari. They said they would look into the issue where if you hit cancel it fails out on future attempts.
Just assign a desired address to the href property, instead of trying to replace the whole window.location object:
window.location.href = 'myapp://do/xx';
It works for me on iOS 9.0.2, but now safari shows a confirmation dialog to ensure а user really wants open your link in the app.
this is how I have revised my Facebook/Google Login integration to get it work on latest update. which now user Safari web view.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
<string>com.googleusercontent.apps.39373238582-opjuqokmar2i5t3sdk2vs5sifer4moen</string>
<string>com-google-gidconsent-google</string>
<string>com-google-gidconsent-youtube</string>
<string>com-google-gidconsent</string>
<string>com.google.gppconsent.2.4.1</string>
<string>com.google.gppconsent.2.4.0</string>
<string>googlechrome</string>
<string>googlechrome-x-callback</string>
</array>
We're writing a native iOS app which integrates with Facebook. Several months ago we set up a placeholder FB app via developers.facebook.com and have been doing all of our testing via that. Now that we're closer to release I thought I'd set up a new, clean, "proper" FB app, with all of the correct app descriptions/URL fields/etc.
As a first step, I've set up the new app to be as similar to the old one as possible and made a new test user. The old app works fine, so I'm reasonably confident that our iOS code is correct (and yes I've switched the app ID in the XCode project and so forth), but when we run with the new app integrated we get this behaviour when trying to authorise the app with the user:
If the iOS Facebook app is installed and the test user is already logged in:
On calling openActiveSessionWithReadPermissions (requesting #"email" permissions), the iOS Facebook app is launched and shows the user the basic info authorisation page for our app.
The user clicks the "Log in" button at the top of the page.
The FB app pops up another, blank window with a "Cancel" button at the top left.
From this point on, nothing the user does will make Facebook return control to our iOS app.
But checking the test user's page afterwards shows that the app has been authorised.
If I uninstall the Facebook app from the device, thereby forcing the request screens to be shown in Safari instead, we get the same behaviour except point (3) above is replaced with:
3) A device alert saying "Safari cannot open the page because the address is invalid". This is the address it's trying to open: https://m.facebook.com/dialog/permissions.request?_path=permissions.request&app_id=<*our_app_id*>&redirect_uri=fb<*our_app_id*>%3A%2F%2Fauthorize&sdk=ios&display=touch&type=user_agent&perms=email&fbconnect=1&sso=iphone-safari&from_login=1&client_id=<*our_app_id*>&refid=9
I've found this behaviour to be the same on iOS 5.1 and 6.0 hardware devices and the 6.0 simulator. Using out old FB app, the authorisation returns correctly. I'm sure that in the app admin page I just haven't set one of the magical, barely-documented option checkboxes correctly, but I really don't know how to go about finding out what's going wrong.
Thanks for any advice!
As it's not returning to your app, you may have forgot to add the URL scheme to your Info.plist. You should have a new entry, here's the XML representation of it:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fbYOUR_APP_ID</string>
</array>
</dict>
</array>
</plist>