uni_links icon indicating copy to clipboard operation
uni_links copied to clipboard

Custom URL Scheme not working on iOS

Open cloudbreakstudios opened this issue 3 years ago • 7 comments

I'm using custom scheme and am testing on my iPad Mini 2 and iPhone 8, which is running 12.4.8.

My Info.plist consists of..

	<array>
		<dict>
			<key>CFBundleTypeRole</key>
			<string>Editor</string>
			<key>CFBundleURLName</key>
			<string>com.cbs.responder</string>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>https</string>
			</array>
		</dict>
	</array>

I then have an email which contains a link...

https://cbs.net/event/?eid=1234567

No matter which iOS device/os I run it always results in opening the browser and not the app!

This is working fine on Android with the following Manifest!

	<intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data
                        android:scheme="https"
                        android:host="cbs.net"
                        android:pathPrefix="/event"/>
            </intent-filter>

I basically need to be able to send an email out that contains the https://cbs.net/event/?eid=1234567 and on both Android and iOS open the app.

If i use a custom scheme i.e. cbs://.. then the email doesn't see it as a real link and the user is unable to click it to go through to the app. If i copy this custom 'cbs://..' link into a browser it opens, however this doesn't work for https links for whatever reason!

cloudbreakstudios avatar Apr 20 '21 12:04 cloudbreakstudios

A custom scheme sometimes is not handled correctly by some apps and I'm guessing the email app you are using is one of these, but that's just a guess. Custom schemes are actually the easier type of linkage to configure, since they do not require hosted files.

If you have access to the files on https://cbs.net or can request files to be hosted on it have a good read in the README's section for setting up iOS. There is a link to a document at the end of the section by Apple, which could provide more detail.

If you do want to test a working custom scheme - clone this repo and open the example iOS project and run it on a device/simulator.

Good luck.

avioli avatar Apr 28 '21 05:04 avioli

A custom scheme sometimes is not handled correctly by some apps and I'm guessing the email app you are using is one of these, but that's just a guess. Custom schemes are actually the easier type of linkage to configure, since they do not require hosted files.

If you have access to the files on https://cbs.net or can request files to be hosted on it have a good read in the README's section for setting up iOS. There is a link to a document at the end of the section by Apple, which could provide more detail.

If you do want to test a working custom scheme - clone this repo and open the example iOS project and run it on a device/simulator.

Good luck.

Thanks - I am now trying the example using the hosted file method, but just getting the website. However my ios/runner/ directory is much different. It has an AppDelegate.swift that contains this. Does this also need updating? If so how? I have read the instructions several times but not understanding why this isnt working (i even have the apple-app-site-association file in root and in .well-known/)!

import UIKit
import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

cloudbreakstudios avatar Apr 28 '21 12:04 cloudbreakstudios

same issue. working fine with other url schemes except https. If I use https in CFBundleURLSchemes it redirects to browser instead of app.

appscriplaxminarayana avatar Mar 25 '22 10:03 appscriplaxminarayana

Same issue here

senenpalanca97 avatar Mar 31 '22 11:03 senenpalanca97

same here too!

amirmhmdi avatar Apr 16 '22 10:04 amirmhmdi

same issue !

Devstored avatar May 28 '22 15:05 Devstored

I am using react native expo, I want to open app from the url in password reset instruction but its not working. here is my scheme defined in app.json "expo": { "scheme": "myapp", } also define the intent filter for android "intentFilters": [ { "action": "VIEW", "data": [{ "scheme": "myapp", "host": "*" }], "category": ["BROWSABLE", "DEFAULT"] } ],

  still both android and ios not working

usmanasifzai avatar Dec 14 '22 09:12 usmanasifzai