【问题标题】:JSON File Not Recognized While Implementing Universal Links实现通用链接时无法识别 JSON 文件
【发布时间】:2020-01-07 05:05:11
【问题描述】:

我正在使用 expo 构建一个简单的应用程序。在为 android 和 iOS 实现链接时,我正在编辑 app.JSON。我去rebuild android build的时候,终端报错:

app.json 必须包含一个 JSON 对象。

终端无法识别 app.JSON。

我还注意到applinks:<librexapp.app.link> 似乎无法识别。我在实现通用链接时缺少什么?代码如下:

  {
  "expo": {
    "name": "Librex",
    "slug": "Librex",
    "privacy": "public",
    "sdkVersion": "35.0.0",
    "platforms": [
      "ios",
      "android",
      "web"
    ],
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "scheme": "librexapp",
    "assetBundlePatterns": [
      "**/*"
    ],
    "android":{
      "package": "com.librex.app",
      "googleServicesFile": "./google-services.json",
      "config":{
        "branch":{
          "apiKey": "Redacted"
        }
      }
    },
    "ios":{
      "supportsTablet": true,
      "associatedDomains":
        [applinks:<librexapp.app.link>],
      "config":{
        "branch":{
          "apiKey":   "Redacted"
      }
    }
  },

    "extra": {
      "firebaseConfig": {
        "apiKey" : "Redacted",
        "authDomain" : "Redacted",
        "databaseURL" : "Redacted",
        "storageBucket": "Redacted",
        "serviceAccount" : "./firebase-private-key.json"
      }
    }
  }
}

【问题讨论】:

    标签: ios json expo branch.io ios-universal-links


    【解决方案1】:

    也许你应该像"applinks:\&lt;librexapp.app.link\&gt;" 这样对字符串进行配额。您可以使用[NSJSONSerialization isValidJSONObject:obj] 来检查 obj 是否为有效的 json 对象。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-01
      • 2016-05-29
      • 2022-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-25
      相关资源
      最近更新 更多