首页 文章

NativeScript - 不能在带有firebase插件的iOS设备上运行

提问于
浏览
0

在真实设备上运行用NativeScrip编写的iOS应用程序是不可能的 . 我尝试了一切 . 应用程序适用于iOS Symulator和Android Emulator但是当我连接iOS设备并运行 ins run ios 时会出错

** EXPORT SUCCEEDED **项目成功建成 . 正在安装...无法在设备上应用更改:XXXXX . 错误是:无法在具有标识符的设备上安装:XXXXX错误是:无法安装应用程序 .

我去了 platforms/ios 并运行生成的Xcode项目 . 然后我构建它并尝试运行 . 出现错误:

应用程序的代码签名权利文件中指定的权利无效,不允许,或与您的配置文件中指定的权限不匹配 . (0xE8008016) .

我已经设置了正确的 TeamProvision Profile .

我不知道如何解决这个问题 . 我只有一个想法 . 我安装了firebase-plugin,需要keychain_sharing,这可能是 Entitlements 的一个问题 .

我的 package.json

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescrip.awsomename",
    "tns-android": {
      "version": "3.1.1"
    },
    "tns-ios": {
      "version": "3.2.0-2017-8-25-1"
    }
  },
  "dependencies": {
    "@angular/animations": "~4.2.0",
    "@angular/common": "~4.2.0",
    "@angular/compiler": "~4.2.0",
    "@angular/core": "~4.2.0",
    "@angular/forms": "~4.2.0",
    "@angular/http": "~4.2.0",
    "@angular/platform-browser": "~4.2.0",
    "@angular/router": "~4.2.0",
    "nativescript-angular": "~4.2.0",
    "nativescript-plugin-firebase": "^4.0.6",
    "nativescript-theme-core": "~1.0.2",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~5.4.2",
    "tns-core-modules": "~3.1.0",
    "zone.js": "~0.8.2"
  },
  "devDependencies": {
    "babel-traverse": "6.26.0",
    "babel-types": "6.26.0",
    "babylon": "6.18.0",
    "lazy": "1.0.11",
    "nativescript-dev-typescript": "~0.5.0",
    "typescript": "~2.4.2"
  }
}

我的 build.cconfig 来自 AppResorces/iOS

// You can add custom settings here
// for example you can uncomment the following line to force distribution code signing
// CODE_SIGN_IDENTITY = iPhone Distribution 
// To build for device with Xcode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html
// DEVELOPMENT_TEAM = YOUR_TEAM_ID;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;

DEVELOPMENT_TEAM = [HERE I HAVE SET MY DEV TEAM ID];
CODE_SIGN_ENTITLEMENTS = swapmobile/swapmobile.entitlements

我使用Xcode 8.3.2

编辑

tns plugin remove nativescript-plugin-firebase 应用程序开始工作后 . 问题出在firebase插件上 .

1 回答

  • 0

    我发现自述文件see issue #420中给出的权利文件适用于模拟器,但随后设备构建会导致权利错误,除非这些权利被删除 . 以下* .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>keychain-access-groups</key>
      <array>
        <string>$(AppIdentifierPrefix)com.Company.Product</string>
      </array>
    </dict>
    </plist>
    

    注意 - 将“com.Company.Product”替换为您的包标识符 .

    这是当您在项目的功能中启用"Keychain Sharing"时Xcode放入的权利条目 . 其他详细信息可以在Apple文档Keychain Services Programming Guide - Access Groups中找到,其中说明:

    Xcode会在代码签名期间自动将应用程序标识符权利添加到每个应用程序 . 此字符串形成为团队标识符和捆绑标识符 .

    设备构建工作时不指定权利,因为它们始终是签名的并且具有上述权利 . 需要明确地为此授权提供无符号模拟器构建 .

相关问题