Open SwiftUI App from other application, Microsoft Teams, Messenger, WhatsApp, etc - ios

I am developing an SwiftUI App that app involves with creating notes like an usual to-do list app. The exception is that the note must be able to be shared to another users via Microsoft Teams, Messengers and WhatsApp.
Thus, I tend to implement some sort of functionalities to send another user one URL link. Every time the users click on the link from third-party app (WhatsApp, Teams, FB), the link will prompt and navigate users to the app that I developed and installed on their machine. Based on the URL my app will perform specific actions.
How I can do that. My current attempt is to define a customer URL for the SwiftUI app.
Thanks for reading this question, cheers.

You are looking for Custom URL Scheme and Universal Links
From documentation:
Custom URL schemes provide a way to reference resources inside your app. Users tapping a custom URL in an email, for example, launch your app in a specified context. Other apps can also trigger your app to launch with specific context data; for example, a photo library app might display a specified image.
let url = URL(string: "myphotoapp:Vacation?index=1")
UIApplication.shared.open(url!) { (result) in
if result {
// The URL was delivered successfully!
}
}

Related

Link to a specific section of my app, or the app store if it hasn't been downloaded?

I'm in the process of updating my iOS app, and one feature that I'd love to add would be the ability to create links (to send via email, or for social media) that would allow users who have downloaded the app to be taken to a certain section of the app, and users who haven't to be taken to the app store page for my app. I also want it to take desktop users to the itunes page for my app.
Now, I've been looking into url schemes as I think this is the way forward, and have managed to create a custom url scheme that will indeed take users to different parts of my app. However, I'm struggling to find a way to check if the app has been installed, and what device the user is on etc.
Would I need to use a server to redirect them to the correct place?
Thanks!
I found out the best way to do it is with universal links, introduced in iOS 9.
https://blog.branch.io/how-to-setup-universal-links-to-deep-link-on-apple-ios-9/

How to shorten a Firebase Dynamic Link using my own domain name

I'm trying to implement Firebase Dynamic Links in an iOS app. The goal is to have a clean URL for marketing purposes so folks can share links on social media. The idea is folks will share the clean URL that starts with my domain name.
When the app is installed following a click on that link, we want to be able to track who referred the app install by looking at the payload delivered by Firebase. I think this goal is similar to Firebase's use case to convert web users to mobile app users.
An example link I would like to provide for sharing on social media is: http://example.com/my-payload-here
I've tried several cases but I'm not able to get the behavior I'm looking for in any case. Has anyone implemented this successfully before?
Here is my test procedure:
Uninstall the app
Send the link to be tested in an iMessage to myself
Tap the link on my iOS device (not using a simulator)
Install the app from the App Store
Launch the app after download completes by tapping "Open" button in the App Store
Below are my findings:
Short link generated from the Firebase Console (https://xyz.app.goo.gl/ABCD) - Link opens in App Store. I install the app. When I launch the app after installing, the payload is not delivered. If I quit out of the app, go back to the link in iMessage, and launch a second time, the payload is delivered.
Long link identical to the "Long Dynamic Link" from the Firebase console for the link generated in #1 (https://xyz.app.goo.gl/?link=http://example.com/my-payload-here&isi=12345&ibi=com.example.MyApp) - behavior is identical to #1
Short link using my domain (http://example.com/redirect/my-payload-here, configured to 301 redirect to URL in #2) - Opens in App Store. I install. When I launch the app after installing, the payload is not delivered. If I quit out of the app, go back to the link in iMessage, and launch a second time, the link still goes to the App Store.
Some questions I have:
Why isn't the payload delivered on the first launch for cases 1 and 2?
How can we make this launch the app and deliver the payload instead of going to the App Store?
I've also consulted the Firebase flowchart for the deep link in case 2.
Google Firebase team added support for custom subdomains to Dynamic Links.
You can now specify up to five custom page.link subdomains for your Dynamic Links. Short links using these new custom subdomains look like the following example: https://example.page.link/abcXYZ
Firebase Dynamic Link domains assigned on projects couldn't be deleted at this time.( firebase team is working on it.)
You can now whitelist the URL patterns that can be used as a Dynamic Link's deep link (link) or fallback link (ifl, ipfl, afl, ofl). If you define a whitelist, Dynamic Links won't redirect to URLs that don't match a whitelisted pattern.
You can try both of these features in the Firebase console.
This is not currently possible with Firebase. If you need whitelabeled URLs, you either need to build it yourself or use a more powerful link platform like Branch.io (full disclosure: I'm on the Branch team).
To answer your questions specifically:
I have implemented Firebase Dynamic Links in a testbed app and can confirm that linking through installation the first time does work for both long and short URL variants. There is likely something wrong with your AppDelegate config, so we can take a look at that if you want to share code.
Firebase does not support custom domains at this time. In theory (if you can solve the first issue above) you could get this working for first install by using a redirect like you have tried. However, you'll never be able to get it to launch the app with Firebase link data once the app is installed. This is because Universal Links work based on the domain of the link, and don't even request the web destination. Even if you enable Universal Links manually on your own domain, the app will open immediately without ever calling Firebase and the link data will never be set.

iOS / Uber integration: link_text and partner_deeplink not working in testing

I'm making an iOS (v8.3+) app which is a mapping app. The user can define a starting point and destination. They can then tap the Share button and choose "Open in Uber", which will launch the Uber app via a deeplink URL like this:
uber://?client_id=MY_CLIENT_ID&action=setPickup&link_text=Watch%20progress%20in%20my%20app&partner_deeplink=SOMEDEEPLINK%3A%2F%2F&pickup[latitude]=123.456&pickup[longitude]=123.456&pickup[nickname]=PICKUP&pickup[formatted_address]=123%20Elm%20St&dropoff[latitude]=123.456&dropoff[longitude]=123.456&dropoff[nickname]=DROPOFF&dropoff[formatted_address]=456%20Elm%20St
(This sample URL includes some obviously fake data, for the sake of simplicity.)
I've registered at Uber and have a valid client ID. This call (via openURL) works correctly: the Uber app launches with the starting point and destination already populated. This is ALL that I've done with Uber; there's no other calls being made at all.
The problem is that the special branding text does not appear within the Uber app during the trip (and of course the related partner_deeplink doesn't work either).
What do I need to do in order to get it to work? Do I need to "enable" this functionality somehow? My app has registered its own custom URL scheme that I use as the "partner_deeplink=SOMEDEEPLINK%3A%2F%2F" portion of the uber:// URL. I know this works because I can use my custom URL scheme in Safari and it successfully launches my app.
Thanks in advance for any insights!
You need to Request Full Access in the Uber Developer Dashboard to get activated for the Trip Branding feature. Please check out the documentation here.
As soon as you're activated, you can set defaults for the custom assets and the deeplink parameters you're referring to are essentially used to dynamically override these defaults.

How to call out to another app within an app - iOS

We use an LMS calles Canvas by instructure. Our students access the LMS via the iOS app, however we would like to be able to call out from this app to another app (e-book reader).
We just want to be able to select a link which will redirect us to the app.
We have a coder in our staff, and we would really appreciate any advise on how to achieve the above.
You can communicate with URL Schemes between apps Apple Inter-App Communication
And here is Tutorial explaining URL Schemes implementation.
If you have access to the e-book reader app's codebase, this is simple to achieve by specifying a URL Scheme this app may respond to (or, alternatively, if you happen to know what URL Schemes this app supports). Then it will be as simple as calling out a URL of a corresponding format from within the iOS app your students use.
Alternatively, if your app provides access to the documents of some sort, you could look into UIDocumentInteractionController that can add "Open in..." functionality to your app, allowing app users to open a document in an arbitrary app that supports this file format.

How to post on Timeline in LINE in iOS?

I want to open NAVER's LINE.app from within my iOS app using a URL scheme, and let my user share my iOS app using the preset string and AppStore URL.
I already set LSApplicationQueriesSchemes, and I know how to share a string to friends (using line://msg/text).
But how can I let him post it to the timeline? I even can't get to the documentation page but they clearly said it is feasible in the docs.
User selects who to share the content with. (Content can be shared with friends or posted on the user’s Timeline).
NOTE: I don't want to share it via Activity Controller. I want to use UIButton to trigger the share action.

Resources