简体   繁体   中英

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

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. 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

在此输入图像描述

You probably will see this picture 在此输入图像描述

Set Host Application to your project name and that's it.

I occasionally got Apple Mach-O Linker Error 1 while trying to implement AdMob Ads. 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.

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. It's a simple process, especially if you're a beginner, it probably won't take too long. I hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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