ios - 如何在 IOS 9 中为通用链接创建 apple-app-site-association 文件?

标签 ios xcode ios9 ios-universal-app

我在创建 apple-app-site-association 文件时遇到了一些问题。我不知道如何创建没有 json extentsion 的 json 文件,并且同一文件的内容类型为 application/json。我想在没有任何签名的情况下使用这个文件,因为它在 IOS 9 中不需要,但我无法创建有效的 apple-app-site-association 文件。

我已经在我的应用程序上设置了所有内容,例如关联域、应用程序委托(delegate)方法、配置文件。

这是我在后端的代码:

{
    "applinks": {
      "apps": [],
      "details": [
          {
             "appID": "teamID.bundleID",
             "paths": [ "*" ]
          }
      ]
   }
 }

最佳答案

另一种方法是使用文件匹配来精确匹配您的文件并强制执行所需的内容类型:

将以下行添加到您的 .htaccess 文件中:

<FilesMatch "^apple-app-site-association$">
    ForceType application/json
</FilesMatch>

这对我有用。

关于ios - 如何在 IOS 9 中为通用链接创建 apple-app-site-association 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34945358/

相关文章:

iOS 13 : Using the new NEHotspotConfiguration. init(ssidPrefix: String) 似乎不起作用

ios - ViewController 方向变化不是动画的

swift2 - 获取联系人添加到 Swift 2、iOS 9 中地址簿的日期

swift - 更改侧边菜单的高度

iphone - 在 iOS 中,使用 ARC,是否足以将所有 ivars 和属性设置为 nil,并在 viewDidUnload 中释放上下文、图像、颜色空间?

ios - 错误 : Index out of range in segment control

ios - UIButton 的 lazy var 或 let

ios - __NSCFConstantString objectAtIndex :]: unrecognized selector sent to instance

iphone - iOS 第二语言本地化

ios - 在两个 View 之间水平滑动