【问题标题】:Failed to tns build ios due as MDFInternationalization and MaterialComponents directories don't exist由于 MDFInternationalization 和 MaterialComponents 目录不存在,无法 tns 构建 ios
【发布时间】:2020-05-08 10:17:27
【问题描述】:

适用于 xCode,但不适用于 原生脚本tnstns build android 很好。

当我执行tns prepare ios && tns build ios 时,我收到以下错误,因为这些目录不存在。 Debug-iphonesimulator 路径确实存在,其中包含一些其他文件和一个文件夹,但 MDFInternationalizationMaterialComponents 不存在。

Merged 749 categories.
    Result: 43068 declarations from 140 top level modules
Done! Running time: 3.81413 sec
Saving metadata generation's stderr stream to: /Users/sylvester/randd/native-script/platforms/ios/build/Debug-iphonesimulator/metadata-generation-stderr-x86_64.txt
~/randd/native-script/platforms/ios
ld: warning: directory not found for option '-F/Users/sylvester/randd/native-script/platforms/ios/build/Debug-iphonesimulator/MDFInternationalization'
ld: warning: directory not found for option '-F/Users/sylvester/randd/native-script/platforms/ios/build/Debug-iphonesimulator/MaterialComponents'
ld: framework not found MDFInternationalization
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: directory not found for option '-F/Users/sylvester/randd/native-script/platforms/ios/build/Debug-iphonesimulator/MDFInternationalization'
ld: warning: directory not found for option '-F/Users/sylvester/randd/native-script/platforms/ios/build/Debug-iphonesimulator/MaterialComponents'
ld: framework not found MDFInternationalization
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Planning build
note: Constructing build description
** BUILD FAILED **

Command xcodebuild failed with exit code 65

我尝试使用 xCode 构建它,并且在 iPhone 模拟器 中使用 工作应用 获得了成功构建强>。

根据我在撰写此问题时的了解,tns 似乎无法生成这些文件夹

我在这里错过了什么?

【问题讨论】:

  • 同样的错误,但与我相反。在 VS 代码上运行成功,但在 Xcode 上抛出异常 ld: framework not found MDFInternationalization
  • 完全相同的问题,在任何地方都找不到帮助... NativeScript 似乎是一连串的痛苦和惩罚!

标签: ios xcode nativescript ios-simulator nativescript-cli


【解决方案1】:

有人在 NativeScript GitHub 存储库上回答了这个问题:

我发现了错误。我用错误的文件打开项目。

这通常是由于打开了 .xcodeproj 文件而不是 .xcworkspace。

当你第一次运行“pod install”时,它会创建一个 .xcworkspace 文件,其中包括您的原始 .xcodeproj 和一个 Pod 项目。您需要关闭 .xcodeproj 并打开 .xcworkspace 代替。

这是通过 Xcode 的 new 创建项目时的常见问题 项目向导 - 我经常忘记我不在工作区中,这是 需要让 Cocoapods 正确链接。

Build failed - ld: framework not found Pods

【讨论】:

    【解决方案2】:

    我在尝试使用 XCode 12 构建应用程序时遇到了同样的问题。 在使用xcode-select再次使用 XCode 11.7 后,可以正常工作。似乎 NativeScript 6 与 XCode 12 不兼容。

    【讨论】:

      【解决方案3】:

      这就是我个人讨厌混合应用程序的原因,但是当您的总部告诉您跳高时,您会说跳多高...

      我必须支持的应用是基于 NS6 和 Xcode 11 构建的。 它在“某些”iOS 14 设备上启动时崩溃,因此修复方法是使用 Xcode 12 重建应用程序。

      但它一直抛出 OP 的错误。

      我通过将应用的 Nativescript 包升级到可用的最新“Nativescript 6”版本解决了这个错误(我不想完全升级到 NS7,因为这可能会引入一些制动变化)。

      根据自己的文章:https://nativescript.org/blog/nativescript-6-7-xcode-compatibility/

      .. 我将软件包升级到这些版本:

      "tns-core-modules": "6.5.20",
      "tns-ios": "6.5.3",
      "nativescript-dev-webpack": "^1.5.1",
      

      另外,之前为了生成和运行优化的发布版本,我正在运行:

      tns run ios --bundle --env.uglify --env.aot
      

      但是,这样一来,应用程序就会在启动时崩溃。

      所以现在,要获得我运行的发布版本:

      tns run ios --release
      

      【讨论】:

        【解决方案4】:

        这是我找到的解决方案 将其复制到您的 Pod 文件中

        pod 'MDFInternationalization'
        
        post_install do |installer|
        installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
        end
        end
        end
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2021-09-13
          • 1970-01-01
          • 2019-02-18
          • 2022-07-30
          • 1970-01-01
          • 2022-12-25
          • 2015-11-15
          • 2019-08-18
          相关资源
          最近更新 更多