xcode 如何修复ionic 2 Apple Mach-O Linker错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43148356/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:52:15  来源:igfitidea点击:

How to fix ionic 2 Apple Mach-O Linker error?

iosxcodecordovaionic2

提问by Ennio

I'm building an ionic 2 app, and I can build the app with ionic build ios and I get no erros, but on xcode when I build my application I get the following error.

我正在构建一个 ionic 2 应用程序,我可以使用 ionic build ios 构建该应用程序,并且没有出现错误,但是在 xcode 上,当我构建我的应用程序时,出现以下错误。

Apple Mach-O Linker (id) Error Linker command failed with exit code 1 (use -v to see invocation).

Apple Mach-O 链接器 (id) 错误链接器命令失败,退出代码为 1(使用 -v 查看调用)。

How can I fix this?

我怎样才能解决这个问题?

Here is my system information

这是我的系统信息

Cordova CLI: 6.5.0

科尔多瓦 CLI:6.5.0

Ionic Framework Version: 2.3.0

离子框架版本:2.3.0

Ionic CLI Version: 2.2.2

离子 CLI 版本:2.2.2

Ionic App Lib Version: 2.2.1

离子应用程序库版本:2.2.1

Ionic App Scripts Version: 1.1.4

离子应用脚本版本:1.1.4

ios-deploy version: 1.9.0

ios-部署版本:1.9.0

OS: macOS Sierra

操作系统:macOS Sierra

Node Version: v6.9.4

节点版本:v6.9.4

Xcode Version: Xcode 8.3 Build version 8E162

Xcode 版本:Xcode 8.3 构建版本 8E162

回答by akz92

You are probably opening the .xcodeprojon Xcode, try opening the .xcworkspace. This fixed this error for me.

您可能.xcodeproj正在 Xcode 上打开 ,请尝试打开.xcworkspace. 这为我修复了这个错误。

回答by 2xSamurai

Had the same issue, spent almost a day trying to figure out what was causing it. For me the following solved it. Everything was working fine on [email protected], but on 4.5.3, I got this annoying error.

遇到了同样的问题,花了将近一天的时间试图找出导致它的原因。对我来说,以下解决了它。在 [email protected] 上一切正常,但在 4.5.3 上,我遇到了这个烦人的错误。

Check if this plugin "cordova-plugin-console" is there in the plugins folder. If it is there, remove it. Then it started building without any errors.

检查插件文件夹中是否有这个插件“ cordova-plugin-console”。如果存在,请将其删除。然后它开始构建,没有任何错误。

ionic cordova plugin remove cordova-plugin-console

离子cordova插件删除cordova-plugin-console

回答by Aaron Furtado

Look for a file named libPods-AppName.ain Frameworksdirectory where AppNameis your app name.

libPods-AppName.a在您的应用程序名称Frameworks所在的目录中查找名为的文件AppName

Deleting it fixes it in most cases.

在大多数情况下,删除它可以修复它。

Take a look at the screenshot for reference.

看一下截图以供参考。

Quick Fix

快速解决

回答by Rochadsouza

Disclaimer: My project uses Ionic v1

免责声明:我的项目使用 Ionic v1

I had the same error and, once I had added a Android-only plugin, I thought that it was the cause of the error - I was wrong (so, ignore this cause if you think the same as I).

我有同样的错误,一旦我添加了一个仅限 Android 的插件,我认为这是错误的原因 - 我错了(所以,如果你和我的想法一样,请忽略这个原因)。

After some search I found the truly cause of the error: the cordova-ios version (4.5). I followed the steps suggested hereand I solve this issue.

经过一番搜索,我找到了错误的真正原因:cordova-ios 版本 (4.5)。我按照这里建议的步骤解决了这个问题。

Steps:

脚步:

ionic cordova platform remove ios
ionic cordova platform add [email protected]
ionic cordova platform

Last step is used to check if [email protected]is actually the installed version.

最后一步用于检查[email protected]是否实际上是已安装的版本。

Hope it helps.

希望能帮助到你。

回答by potbaron

In your platforms folder for ios, there are both .xcodeproj and .xcworkspace files. Open the /platforms/ios/.xcworkspace.

在 ios 的平台文件夹中,有 .xcodeproj 和 .xcworkspace 文件。打开 /platforms/ios/.xcworkspace。

回答by Ennio

I found the issue that was causing this error.

我发现了导致此错误的问题。

On the config.xml file on the tag I had the email with [email protected] and you cannot have the .com on the email. I removed and it works fine now.

在标签上的 config.xml 文件中,我收到了带有 [email protected] 的电子邮件,而您的电子邮件上不能有 .com。我删除了,现在工作正常。

Thanks for the help

谢谢您的帮助