简体   繁体   English

Xcode Apple Mach-O链接器错误1

[英]Xcode Apple Mach-O Linker Error 1

after renaming my project whenever I try to build the app I get an Apple Mach-O Linker Error below is the output from Xcode itself 每当我尝试构建应用程序重命名我的项目后,我得到一个Apple Mach-O链接器错误下面是Xcode本身的输出

Ld /Users/joshevans/Library/Developer/Xcode/DerivedData/Broadcast!-gbvxmzbukuqqgxcmlipegtnzosze/Build/Products/Debug-iphonesimulator/Broadcast!Tests.xctest/Broadcast!Tests normal x86_64
    cd "/Users/joshevans/Desktop/sn app/SwifferApp"
    export IPHONEOS_DEPLOYMENT_TARGET=8.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-arch x86_64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk
-L/Users/joshevans/Library/Developer/Xcode/DerivedData/Broadcast!-gbvxmzbukuqqgxcmlipegtnzosze/Build/Products/Debug-iphonesimulator
-F/Users/joshevans/Library/Developer/Xcode/DerivedData/Broadcast!-gbvxmzbukuqqgxcmlipegtnzosze/Build/Products/Debug-iphonesimulator
-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/Developer/Library/Frameworks
-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks
-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/Developer/Library/Frameworks
-filelist /Users/joshevans/Library/Developer/Xcode/DerivedData/Broadcast!-gbvxmzbukuqqgxcmlipegtnzosze/Build/Intermediates/Broadcast!.build/Debug-iphonesimulator/Broadcast!Tests.build/Objects-normal/x86_64/Broadcast!Tests.LinkFileList
-Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -bundle_loader /Users/joshevans/Library/Developer/Xcode/DerivedData/Broadcast!-gbvxmzbukuqqgxcmlipegtnzosze/Build/Products/Debug-iphonesimulator/SwifferApp.app/SwifferApp
-Xlinker -objc_abi_version -Xlinker 2 -framework XCTest -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator
-Xlinker -add_ast_path -Xlinker /Users/joshevans/Library/Developer/Xcode/DerivedData/Broadcast!-gbvxmzbukuqqgxcmlipegtnzosze/Build/Intermediates/Broadcast!.build/Debug-iphonesimulator/Broadcast!Tests.build/Objects-normal/x86_64/Broadcast_Tests.swiftmodule
-mios-simulator-version-min=8.0 -Xlinker -dependency_info -Xlinker /Users/joshevans/Library/Developer/Xcode/DerivedData/Broadcast!-gbvxmzbukuqqgxcmlipegtnzosze/Build/Intermediates/Broadcast!.build/Debug-iphonesimulator/Broadcast!Tests.build/Objects-normal/x86_64/Broadcast!Tests_dependency_info.dat
-o /Users/joshevans/Library/Developer/Xcode/DerivedData/Broadcast!-gbvxmzbukuqqgxcmlipegtnzosze/Build/Products/Debug-iphonesimulator/Broadcast!Tests.xctest/Broadcast!Tests ld: file not found: /Users/joshevans/Library/Developer/Xcode/DerivedData/Broadcast!-gbvxmzbukuqqgxcmlipegtnzosze/Build/Products/Debug-iphonesimulator/SwifferApp.app/SwifferApp clang: error: linker command failed with exit code 1 (use -v to see invocation)

thanks for your help, as I'm new to Xcode and the swift language. 感谢您的帮助,因为我是Xcode和快速语言的新手。 Josh 玩笑

After rename just go to your project file ( Where you will see tabs : General, Capabilities, Info etc) 重命名后,只需转到您的项目文件(您将看到标签:常规,功能,信息等)

And choose YourAppTests in the list of the left side 并在左侧列表中选择YourAppTests

在此输入图像描述

You probably will see this picture 你可能会看到这张照片 在此输入图像描述

Set Host Application to your project name and that's it. 将Host Application设置为您的项目名称,就是这样。

I occasionally got Apple Mach-O Linker Error 1 while trying to implement AdMob Ads. 我在尝试实施AdMob广告时偶尔会遇到Apple Mach-O Linker Error 1 The way I dealt with it was by first going into my app's build settings and locating "library search paths" and clearing all of the search paths. 我处理它的方式是首先进入我的应用程序的构建设置并找到“库搜索路径”并清除所有搜索路径。 I then re-added the AdMob folder to the project, and the error disappeared. 然后我将AdMob文件夹重新添加到项目中,错误消失了。

Now obviously your situation is a little different. 现在显然你的情况有点不同了。 Personally, I would rename the file back to its previous name. 就个人而言,我会将文件重命名为以前的名称。 If the error still persists, then clear the library search paths. 如果错误仍然存​​在,则清除库搜索路径。 Still an error? 仍然是一个错误? What I did when I kept receiving the error was create a new Xcode project with the name I want, and then copy all of the files into the new project. 我在收到错误时所做的是创建一个名为I want的新Xcode项目,然后将所有文件复制到新项目中。 It's a simple process, especially if you're a beginner, it probably won't take too long. 这是一个简单的过程,特别是如果你是一个初学者,它可能不会花太长时间。 I hope this helps! 我希望这有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM