简体   繁体   English

iOS 应用程序链接在设备上不起作用,但在模拟器上打开应用程序

[英]iOS applink not working on the device but opens app on simulator

I tried to follow as many as suggestions as possible but could not get it to work on my app which is still in development (not in appstore yet).我尝试尽可能多地遵循建议,但无法让它在我仍在开发中的应用程序上运行(尚未在 appstore 中)。 Here are the details:以下是详细信息:

Only testing in iOS 14 for now.目前仅在 iOS 14 中进行测试。

Following JSON file "apple-app-site-association" stored both under Wordpress web root as well as under.well-known/在 Wordpress web root 和 under.well-known/

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "XXXXXXXXXX.com.xxx.myapp",
                "paths": [
                    "item/*"
                ]
            }
        ]
    }
}

Forcing MIME type with .htaccess使用 .htaccess 强制 MIME 类型

<Files apple-app-site-association>
ForceType application/json
</Files>

curl -v to https://mydomain/.well-known/apple-app-site-association returns content with right mime type application/json and status code 200. curl -v到 https://mydomain/.well-known/apple-app-site-association 返回具有正确 mime 类型application/json和状态码 200 的内容。

Here is the .entitlements file:这是.entitlements文件:

<?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">
<dict>
        <key>aps-environment</key>
        <string>development</string>
        <key>com.apple.developer.associated-domains</key>
        <array>
                <string>applinks:www.myapp.com</string>
                <string>applinks:www.myapp.com?mode=developer</string>
        </array>
</dict>
</plist>

Enabled Associated Domains Debugging in Settings -> Developer menu.在设置 -> 开发人员菜单中启用Associated Domains Debugging

Added Associated Domains capability in the developer.apple.com portal.在 developer.apple.com 门户中添加了Associated Domains功能。

Verified OK with https://branch.io/resources/aasa-validator/使用https://branch.io/resources/aasa-validator/验证正常

Implemented the delegate methods but not invoked实现了委托方法但未调用

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    print("Opening app thru applink")
    // ....
    return true
}

Server access logs have this line which indicates either Apple Bot or the device accessed it服务器访问日志有这一行,表示 Apple Bot 或访问它的设备

00.000.00.00 - - [04/Mar/2021:23:05:19 -0700] "GET /.well-known/apple-app-site-association HTTP/1.1" 200 133 "-" "swcd (unknown version) CFNetwork/1220.1 Darwin/20.3.0" **0/507**

Not seeing and swcd errors in device logs related to this.在与此相关的设备日志中看不到和swcd错误。

Tried both debug and release builds.尝试了调试和发布版本。

Anything else I can do to troubleshoot?我还能做些什么来解决问题?

Finally figured out.终于想通了。 Was missing couple of things:缺少几件事:

  1. Paths in the association file must have "/" prefix like "/item/*"关联文件中的路径必须具有“/”前缀,例如"/item/*"
  2. Was using Team ID in the "appID" field, but using App prefix ID helped在“appID”字段中使用团队 ID,但使用应用前缀 ID 有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Swift应用程序在模拟器上打开但不在设备上打开 - Swift App Opens on Simulator But Not on Device Dropbox错误在设备而非模拟器上打开了另一个应用程序 - Dropbox Error Opens Another App on device, not on simulator iOS数据库应用程序(phonegap)-在模拟器上运行,但在设备上不运行 - IOS database app(phonegap)- working on simulator but not working on device phonegap iOS应用程序可在模拟器上运行,但不能在设备上运行。 如何调试 - phonegap iOS app working on simulator but not in device. How to debug 应用程序在后台处理模拟器但不在设备上时更新位置(iOS 9) - Updating locations while app in background working on simulator but not on device (iOS 9) Expo 应用程序在 Expo Go 和 iOS 模拟器上工作,但在真实设备上崩溃 - Expo app working on Expo Go and iOS Simulator but crashes on real device Tabbarcontroller在模拟器上工作而不在iOS设备上 - Tabbarcontroller is working in simulator not on iOS device iOS应用程序建立在设备上,但不是模拟器 - iOS app builds on device, but not Simulator Flutter iOS 应用程序在模拟器中完美运行,但在真实设备中无法运行 - Flutter iOS app working perfect in simulator but not in real device ios:定时器在模拟器中工作但不在设备上工作 - ios: Timer working in simulator but not on device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM