简体   繁体   English

apple-app-site-association JSON 没有出现?

[英]apple-app-site-association JSON not showing up?

I have implemented my association like it is done here , but when I then go to check the JSON by doing: https://day21.co/apple-app-site-association .我已经像在这里完成了我的关联,但是当我然后 go 通过执行以下操作检查 JSON 时: https://day21.co/apple-app-site-association

This shows up:这显示:

{"applinks":{"apps":[],"details":[]}}

Rather than what I have in the file:而不是我在文件中的内容:

    {
    "applinks": {
        "apps": [],
        "details": [
        {
            "appID": "BID.com.Name.SignUpFlowclub"
            "paths": ["*"]
        }
        ]
    }
}

Here you can see the placement of the file, which I firebase deployed to hosting successfully.在这里可以看到文件的放置,我把firebase部署到主机成功了。 https://i.stack.imgur.com/tX5K2.png https://i.stack.imgur.com/tX5K2.png

What am I doing wrong?我究竟做错了什么?

you trying to read .txt file.您试图读取.txt文件。

just change that extension to .json and read again.只需将该扩展名更改为.json并再次阅读。

And read json like below.并阅读 json 如下所示。

func readJson() {
        let jsonUrl = Bundle.main.url(forResource: "apple-app-site-association", withExtension: "json")!
        do {
            let data = try Data(contentsOf: jsonUrl, options: .mappedIfSafe)
            let jsonResult = try JSONSerialization.jsonObject(with: data, options: .mutableLeaves)
            let result = jsonResult as! [String : Any]
        } catch let error {
            print(error)
        }
    }

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM