サーバ側
-
apple-app-site-association
ファイル- ファイルの書き方が正しいか
- ファイルに
.json
など拡張子は何もつけない。 -
appIDs
キーに関して、<チームID>.<バンドルID>
という形式になっているか。 -
apps: []
というキー・バリューについて、iOS13以降であれば消していい。iOS12以前もサポートするのであれば、残す必要がある。 -
appID
キーについて、iOS13以降はappIDs
キーに変えることもできる。iOS12以前をサポートするならそのままにする。 -
paths
キーについて、iOS13以降はcomponents
キーに変えることもできる。iOS12以前をサポートするならそのままにする。
- ファイルに
- ファイルの書き方が正しいか
Supporting Universal Links in Your App
通常はS3などにファイルを置くことになると思われる。
https://dev.classmethod.jp/articles/universal-links/
{
"applinks": {
"details": [
{
"appIDs": [ "ABCDE12345.com.example.app", "ABCDE12345.com.example.app2" ],
"components": [
{
"#": "no_universal_links",
"exclude": true,
"comment": "Matches any URL whose fragment equals no_universal_links and instructs the system not to open it as a universal link"
},
{
"/": "/buy/*",
"comment": "Matches any URL whose path starts with /buy/"
},
{
"/": "/help/website/*",
"exclude": true,
"comment": "Matches any URL whose path starts with /help/website/ and instructs the system not to open it as a universal link"
},
{
"/": "/help/*",
"?": { "articleNumber": "????" },
"comment": "Matches any URL whose path starts with /help/ and which has a query item with name 'articleNumber' and a value of exactly 4 characters"
}
]
}
]
}
}
{
"applinks": {
"apps": [],
"details": [
{
"appID": "9JA89QQLNQ.com.apple.wwdc",
"paths": [ "/wwdc/news/", "/videos/wwdc/2015/*"]
},
{
"appID": "ABCD1234.com.apple.wwdc",
"paths": [ "*" ]
}
]
}
}
-
content-type
はapplication/json
か -
ファイルの置き場が正しいか。
-
apple-app-site-association
をサーバの.well-knownディレクトリ の下に配置するようにしなければならない。ルートに直接おくことも以前は認められていたが、今はNG。
-
-
優先度の高いアプリのバンドルIDを先に記載しているか。
The order of the dictionaries in the array determines the order the system follows when looking for a match, so you can specify an app to handle a particular part of your website. Because the system evaluates each path in the paths array in the order it is specified—and stops evaluating when a positive or negative match is found—you should specify high priority paths before low priority paths.
- ユニバーサルリンクのURLと同じドメインのURLをSafariで開いていないか?
When a user is browsing your website in Safari and they tap a universal link to a URL in the same domain as the current webpage, iOS respects the user’s most likely intent and opens the link in Safari. If the user taps a universal link to a URL in a different domain, iOS opens the link in your app.
(訳)今Safariでウェブページを見ており、ユニバーサルリンクのURLをタップしたが、そのドメインが今見ているウェブページのドメインと同じ場合は、ユーザーの最も意図していそうな振る舞いをするため、そのユニバーサルリンクをSafariで開く。別のドメインのURLをタップした場合は、アプリを起動する。
- TestFlight版だと、アプリをインストールしてからapple-app-site-associationがダウンロードされるまでに数十分〜2時間ほどかかるとのこと。
その他:
Setting up iOS Universal Links
アプリ側
- apple developerのサイトにて、アプリのBundle Identifierの項で
Capabilities
のAssociated Domains
にチェックが入っているかどうか。 - Xcode > Targets > Signing & Capabilities に
applinks:<ドメイン名>
という形式でドメイン名を記載しているかどうか。 -
AppDelegate
のfunc application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool
にてハンドリング処理を入れているかどうか。-
userActivity.activityType
がNSUserActivityTypeBrowsingWeb
かどうかのチェックを入れているか。 - アプリ側に渡されるURLは
userActivity.webpageURL
内に入っているが、それをハンドリングしているか。
-
デバッグ
Console.appからファイルがダウンロード開始されたかのログを見ることができる。また、iPhoneでsystem diagnosis ファイルを作成し、実際にダウンロードされたかの結果をPCで見ることもできる。https://www.youtube.com/watch?v=xxyEq_ySoO4
そのほか: https://developer.apple.com/jp/documentation/technotes/tn3155-debugging-universal-links/
参考
Supporting Universal Links in Your App
Support Universal Links
What's new in Universal Links(2020)
What's New in Universal Links(2019)
FlutterアプリをFirebase HostingでDeepLink対応する
TN3155:ユニバーサルリンクのデバッグ