Nativescript - 为 Nativescript 插件设置目标 IOS 版本 [英] Nativescript - Set the target IOS version for Nativescript plugins

查看:76
本文介绍了Nativescript - 为 Nativescript 插件设置目标 IOS 版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将我的 xcode 更新为 Xcode12 的测试版,以便我可以看到我的应用程序将如何在即将发布的 IOS 14 版本上运行

I recently updated my xcode to the beta for Xcode12 so I can see how my app will run on the upcoming release of IOS 14

尝试运行 TNS RUN IOS 时出现以下错误:

When trying to run TNS RUN IOS I get the following errors:

Saving metadata generation's stderr stream to: /Users/USER/Desktop/Projects/APP/platforms/ios/build/Debug-iphonesimulator/metadata-generation-stderr-x86_64.txt
~/Desktop/Projects/APP/platforms/ios
ld: building for iOS Simulator, but linking in dylib built for iOS, file '/Users/USER/Desktop/Projects/APP/platforms/ios/internal//NativeScript.framework/NativeScript' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Building targets in parallel
note: Using codesigning identity override:
note: Planning build
note: Using build description from disk
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'MDFInternationalization' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'IQKeyboardManager' from project 'Pods')

这是我的 Podfile

Here is my Podfile

use_frameworks!
target "ClientApp" do
# NativeScriptPlatformSection /Users/USER/Desktop/Projects/APP/node_modules/tns-core-modules/platforms/ios/Podfile with 9.0
platform :ios, '9.0'
# End NativeScriptPlatformSection
# Begin Podfile - /Users/USER/Desktop/Projects/APP/node_modules/tns-core-modules/platforms/ios/Podfile
# platform :ios, '9.0'
use_frameworks!
pod 'MaterialComponents/Tabs', '~> 84.4'
# End Podfile
# Begin Podfile - /Users/USER/Desktop/Projects/APP/node_modules/nativescript-iqkeyboardmanager/platforms/ios/Podfile
pod 'IQKeyboardManager', '~> 6.2.0'
# platform :ios, '9.0'
# End Podfile
end

我也试过这个并且得到同样的错误

I've also tried this and got the same error

use_frameworks!
target "ClientApp" do
# NativeScriptPlatformSection /Users/USER/Desktop/Projects/APP/node_modules/tns-core-modules/platforms/ios/Podfile with 9.0
platform :ios, '9.0'
# End NativeScriptPlatformSection
# Begin Podfile - /Users/USER/Desktop/Projects/APP/node_modules/tns-core-modules/platforms/ios/Podfile
# platform :ios, '9.0'
use_frameworks!
pod 'MaterialComponents/Tabs', '~> 84.4'
# End Podfile
# Begin Podfile - /Users/USER/Desktop/Projects/APP/node_modules/nativescript-iqkeyboardmanager/platforms/ios/Podfile
pod 'IQKeyboardManager', '~> 6.2.0'
# platform :ios, '9.0'
# End Podfile
end
post_install do |pi|
    pi.pods_project.targets.each do |t|
        t.build_configurations.each do |config|
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
        end
    end
end

我已经尝试取消注释掉 Podfile 中的注释.

And I've tried un-commenting out the comments in the Podfile.

这里也是我的 package.json

And here's also my package.json

{
  "nativescript": {
    "id": {
      "ios": "{{ID}}",
      "android": "{{ID}}",
    },
    "tns-android": {
      "version": "6.1.1"
    },
    "tns-ios": {
      "version": "6.5.2"
    }
  },
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "scripts": {
    "lint": "tslint \"src/**/*.ts\""
  },
  "dependencies": {
    "@angular/animations": "~8.2.0",
    "@angular/common": "~8.2.0",
    "@angular/compiler": "~8.2.0",
    "@angular/core": "~8.2.0",
    "@angular/forms": "~8.2.0",
    "@angular/platform-browser": "~8.2.0",
    "@angular/platform-browser-dynamic": "~8.2.0",
    "@angular/router": "~8.2.0",
    "@types/node": "^12.12.11",
    "jwt-decode": "^2.2.0",
    "nativescript-angular": "~8.2.0",
    "nativescript-cardview": "^3.2.0",
    "nativescript-drop-down": "^5.0.4",
    "nativescript-filterable-listpicker": "^2.2.6",
    "nativescript-iqkeyboardmanager": "^1.5.1",
    "nativescript-materialdropdownlist": "^1.0.15",
    "nativescript-phone": "^1.4.1",
    "nativescript-theme-core": "~1.0.6",
    "nativescript-ui-autocomplete": "^5.1.1",
    "nativescript-ui-sidedrawer": "~7.0.0",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.4.0",
    "tns-core-modules": "~6.1.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular/cli": "^8.3.5",
    "@angular/compiler-cli": "~8.2.0",
    "@nativescript/schematics": "^0.7.1",
    "@ngtools/webpack": "~8.2.0",
    "@types/jasmine": "^3.4.0",
    "codelyzer": "~4.5.0",
    "nativescript-dev-webpack": "^1.4.0",
    "node-sass": "^4.7.1",
    "tslint": "~5.19.0",
    "typescript": "~3.5.3"
  }
}

我也收到了与 firebase 插件相同的错误,但我已将其删除.

I was also receiving the same error with a firebase plugin but I removed it.

理想情况下,我应该能够让所有依赖项都针对相同的 IOS 版本,然后如果有问题,我会从那里解决.有什么想法吗?

Ideally, I should be able to get all dependencies to target the same IOS version, then if there's problems i'll figure it out from there. Any ideas?

推荐答案

我通过在 App_Resources/iOS 文件夹中添加一个 Podfile 并在文件中添加以下代码解决了这个问题.

I solved this by adding a Podfile in the App_Resources/iOS folder with the following code inside the file.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

这会遍历 pod,删除其部署目标,从而允许它们继承设置.必须确保删除平台文件夹并重新构建后才能使更改生效.

This loops through the pods deleting their deployment targets allowing them to inherit the settings. Must make sure you delete the platforms folder after and rebuild for the changes to take effect.

添加的 Podfile 将与平台中生成的 Podfile 合并.

The added Podfile will be merged with the generated Podfile in platforms.

这篇关于Nativescript - 为 Nativescript 插件设置目标 IOS 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆