Xcode File not found while trying to run app - xcode

I'm Getting this error in Xcode then I try to run my app
Ld /Users/danielsorensen/Library/Developer/Xcode/DerivedData/Keyboard-cimemloksqjdnxhkdziqxwhxgwcg/Build/Products/Debug-iphonesimulator/KeyboardTests.xctest/KeyboardTests normal x86_64
cd "/Users/danielsorensen/Downloads/codecanyon-9105493-color-keyboard-universal/Color Custom Keyboard"
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.0.sdk -L/Users/danielsorensen/Library/Developer/Xcode/DerivedData/Keyboard-cimemloksqjdnxhkdziqxwhxgwcg/Build/Products/Debug-iphonesimulator -F/Users/danielsorensen/Library/Developer/Xcode/DerivedData/Keyboard-cimemloksqjdnxhkdziqxwhxgwcg/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.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.0.sdk/Developer/Library/Frameworks -filelist /Users/danielsorensen/Library/Developer/Xcode/DerivedData/Keyboard-cimemloksqjdnxhkdziqxwhxgwcg/Build/Intermediates/Keyboard.build/Debug-iphonesimulator/KeyboardTests.build/Objects-normal/x86_64/KeyboardTests.LinkFileList -Xlinker -rpath -Xlinker #executable_path/Frameworks -Xlinker -rpath -Xlinker #loader_path/Frameworks -bundle_loader /Users/danielsorensen/Library/Developer/Xcode/DerivedData/Keyboard-cimemloksqjdnxhkdziqxwhxgwcg/Build/Products/Debug-iphonesimulator/Color\ Custom\ Keyboard.app/Color\ Custom\ Keyboard -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/danielsorensen/Library/Developer/Xcode/DerivedData/Keyboard-cimemloksqjdnxhkdziqxwhxgwcg/Build/Intermediates/Keyboard.build/Debug-iphonesimulator/KeyboardTests.build/Objects-normal/x86_64/KeyboardTests.swiftmodule -mios-simulator-version-min=8.0 -Xlinker -dependency_info -Xlinker /Users/danielsorensen/Library/Developer/Xcode/DerivedData/Keyboard-cimemloksqjdnxhkdziqxwhxgwcg/Build/Intermediates/Keyboard.build/Debug-iphonesimulator/KeyboardTests.build/Objects-normal/x86_64/KeyboardTests_dependency_info.dat -o /Users/danielsorensen/Library/Developer/Xcode/DerivedData/Keyboard-cimemloksqjdnxhkdziqxwhxgwcg/Build/Products/Debug-iphonesimulator/KeyboardTests.xctest/KeyboardTests
ld: file not found: /Users/danielsorensen/Library/Developer/Xcode/DerivedData/Keyboard-cimemloksqjdnxhkdziqxwhxgwcg/Build/Products/Debug-iphonesimulator/Color Custom Keyboard.app/Color Custom Keyboard
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I got the same error and I solved it by following these steps:
1) Go to the project
2) On the left side bar (in the screen that appears click on Tests
3) Go to the build settings tab and look for "test host"
4) Now the path that appears in the field is probably wrong so you just need to update it to the appropriate one (In my particular case I renamed the project and some folders and so some paths were wrong)
If you still see the error then you might need to fix some other paths in the Build settings tabs.

Go to Project -- > Build Settings --> Testing --> Test Host
Remove the paths from Debug and Release and give the correct path.
If you don't know the correct path just keep it empty and then clean it and build.
This works fine for me.

I got this fixed by selecting the Tests target and searching for Bundle Loader in Build Settings and changing the product name in that path. I got this error because I have changed the Product name. The Bundle loader has the old product name in the path, so it searches for that path.

Go to project name that given on top. Click on it. Go to "New Scheme" and change the Name to whatever you want.

Related

Framework not found error after adding my own framework

I'm trying to learn a framework flow using this guide: https://www.raywenderlich.com/126365/ios-frameworks-tutorial. Created a separate cocoa framework project, moved some code there - it builds successfully, resulting in DehancerNavigation.framework file.
Now I'm trying to add this framework to another project: just created a blank project for this and added my framework to Embedded binaries in on General tab. It also appeared in Linked Frameworks and Libraries section.
General tab with added framework
Seems to be enough, but now I get a buildtime error:
Ld /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Products/Debug/DehancerNavigationTestUsageProject.app/Contents/MacOS/DehancerNavigationTestUsageProject normal x86_64
cd /Users/yefim/Documents/Projects/DehancerNavigationTestUsageProject
export MACOSX_DEPLOYMENT_TARGET=10.13
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -L/Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Products/Debug -F/Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Products/Debug -filelist /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Intermediates.noindex/DehancerNavigationTestUsageProject.build/Debug/DehancerNavigationTestUsageProject.build/Objects-normal/x86_64/DehancerNavigationTestUsageProject.LinkFileList -Xlinker -rpath -Xlinker #executable_path/../Frameworks -mmacosx-version-min=10.13 -Xlinker -object_path_lto -Xlinker /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Intermediates.noindex/DehancerNavigationTestUsageProject.build/Debug/DehancerNavigationTestUsageProject.build/Objects-normal/x86_64/DehancerNavigationTestUsageProject_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -Xlinker -add_ast_path -Xlinker /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Intermediates.noindex/DehancerNavigationTestUsageProject.build/Debug/DehancerNavigationTestUsageProject.build/Objects-normal/x86_64/DehancerNavigationTestUsageProject.swiftmodule -framework DehancerNavigation -Xlinker -dependency_info -Xlinker /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Intermediates.noindex/DehancerNavigationTestUsageProject.build/Debug/DehancerNavigationTestUsageProject.build/Objects-normal/x86_64/DehancerNavigationTestUsageProject_dependency_info.dat -o /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Products/Debug/DehancerNavigationTestUsageProject.app/Contents/MacOS/DehancerNavigationTestUsageProject
ld: framework not found DehancerNavigation
clang: error: linker command failed with exit code 1 (use -v to see invocation).
Is there something else I need to setup to use framework in project?
Problem solved when I copied framework to my project folder instead of making a reference to it (copy items if needed checker should be set).

Linking to Sqlite in Xcode 7

I'm following this tutorial here: http://www.techotopia.com/index.php/An_Example_SQLite_based_iOS_8_Application_using_Swift_and_FMDB - unfortunately it's written for Xcode 6, not 7.
I followed these steps up to "Creating and Preparing the SQLite Application Project":
Once the project has been created, the next step is to configure the project to include the SQLite dynamic library (libsqlite3.dylib) during the link phase of the build process. Failure to include this library will result in build errors.
To add this library, select the target entry in the Xcode project navigator (the top entry with the product name) to display the General information panel. Select the Build Phases tab to display the build information. The Link Binary with Libraries section lists the libraries and frameworks already included in the project. To add another library or framework click on the ‘+’ button to display the full list. From this list search for, and then select libsqlite3.dylib and click Add.
...however libsqlite3.dylib is not in the list, so I selected libsqlite3.tbd instead (libsqlite3.0.tbd was also listed, but I didn't select it).
However when I build the project I get this output:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_FMDatabase", referenced from:
type metadata accessor for __ObjC.FMDatabase in Database.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I found this QA which isn't of much help ( Undefined symbols for architecture i386 using libsqlite3.dylib with FMDB Xcode 7 ios9 ) because the solutions offered are to either add libsqlite3.dylib (which doesn't exist, I searched in my filesystem), or to add a reference to libsqlite3.tbd which I have done already.
Here's my linker command (formatted for readability):
Ld build/Debug-iphonesimulator/MyApp.app/MyApp normal i386
cd "/Users/me/src-me/MyApp"
export IPHONEOS_DEPLOYMENT_TARGET=9.2
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-arch i386
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk
-L/Users/(me)/src-me/MyApp/build/Debug-iphonesimulator
-F/Users/(me)/src-me/MyApp/build/Debug-iphonesimulator
-filelist /Users/(me)/src-me/MyApp/build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp.LinkFileList
-Xlinker
-rpath
-Xlinker #executable_path/Frameworks
-mios-simulator-version-min=9.2
-Xlinker
-objc_abi_version
-Xlinker 2 -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator
-Xlinker
-add_ast_path
-Xlinker /Users/(me)/src-me/MyApp/build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp.swiftmodule
-lsqlite3
-framework ExternalAccessory
-Xlinker
-dependency_info
-Xlinker /Users/(me)/src-me/MyApp/build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp_dependency_info.dat
-o /Users/(me)/src-me/MyApp/build/Debug-iphonesimulator/MyApp.app/MyApp
Do not link to the .tbd file. Just add -lsqlite3 to the Other Linker Flags build setting.

xcode 7.2 Linker command failed with exit code 1

I am having the devil of a time with an error in XCode 7.2 the full of the build error is as follows..
Ld /Users/skrite/Library/Developer/Xcode/DerivedData/PivoTrac-endythvhjbfwtchiigrtipfugerp/Build/Products/Debug-iphonesimulator/PivoTrac.app/PivoTrac normal x86_64
cd /Users/skrite/XCode-Projects/PivoTrac
export IPHONEOS_DEPLOYMENT_TARGET=9.2
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk -L/Users/skrite/Library/Developer/Xcode/DerivedData/PivoTrac-endythvhjbfwtchiigrtipfugerp/Build/Products/Debug-iphonesimulator -F/Users/skrite/Library/Developer/Xcode/DerivedData/PivoTrac-endythvhjbfwtchiigrtipfugerp/Build/Products/Debug-iphonesimulator -filelist /Users/skrite/Library/Developer/Xcode/DerivedData/PivoTrac-endythvhjbfwtchiigrtipfugerp/Build/Intermediates/PivoTrac.build/Debug-iphonesimulator/PivoTrac.build/Objects-normal/x86_64/PivoTrac.LinkFileList -Xlinker -rpath -Xlinker #executable_path/Frameworks -mios-simulator-version-min=9.2 -Xlinker -objc_abi_version -Xlinker 2 -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/skrite/Library/Developer/Xcode/DerivedData/PivoTrac-endythvhjbfwtchiigrtipfugerp/Build/Intermediates/PivoTrac.build/Debug-iphonesimulator/PivoTrac.build/Objects-normal/x86_64/PivoTrac.swiftmodule /Users/skrite/Library/Developer/Xcode/DerivedData/PivoTrac-endythvhjbfwtchiigrtipfugerp/Build/Products/Debug-iphonesimulator/Alamofire.framework/Alamofire -Xlinker -dependency_info -Xlinker /Users/skrite/Library/Developer/Xcode/DerivedData/PivoTrac-endythvhjbfwtchiigrtipfugerp/Build/Intermediates/PivoTrac.build/Debug-iphonesimulator/PivoTrac.build/Objects-normal/x86_64/PivoTrac_dependency_info.dat -o /Users/skrite/Library/Developer/Xcode/DerivedData/PivoTrac-endythvhjbfwtchiigrtipfugerp/Build/Products/Debug-iphonesimulator/PivoTrac.app/PivoTrac
ld: framework not found Realm for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
it is strange. I have reset my code from git a few times and there are a couple of times that it has worked (made the arrow go away) but usually not. It may have something to do with ios charts library that went missing.
The last time i got it working again was by removing (deleting) iosCharts from my project navigator, but part of it must still be there or misplaced because i did not get an error about "import Charts" and when i ran the app, it loaded a chart. However, as i am writing new code (only editing one file) the above error shows up again. I have been working on this since early yesterday. Thanks for any tips. I am very new at this.

Swift 2 iOS 9 - ld: warning: directory not found iPhoneSimulator9.0.sdk/Developer/Library/Frameworks

I have a warning in my ios appTests:
Ld /Users/Mazorati/Library/Developer/Xcode/DerivedData/exchangerate-fxnywlxmtfpaccbcpsmygvhirtma/Build/Products/Debug-iphonesimulator/exchangerateTests.xctest/exchangerateTests normal x86_64
cd /Users/Mazorati/Projects/iOS/exchangerate
export IPHONEOS_DEPLOYMENT_TARGET=8.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/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/iPhoneSimulator9.0.sdk -L/Users/Mazorati/Library/Developer/Xcode/DerivedData/exchangerate-fxnywlxmtfpaccbcpsmygvhirtma/Build/Products/Debug-iphonesimulator -F/Users/Mazorati/Library/Developer/Xcode/DerivedData/exchangerate-fxnywlxmtfpaccbcpsmygvhirtma/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -filelist /Users/Mazorati/Library/Developer/Xcode/DerivedData/exchangerate-fxnywlxmtfpaccbcpsmygvhirtma/Build/Intermediates/exchangerate.build/Debug-iphonesimulator/exchangerateTests.build/Objects-normal/x86_64/exchangerateTests.LinkFileList -Xlinker -rpath -Xlinker #executable_path/Frameworks -Xlinker -rpath -Xlinker #loader_path/Frameworks -mios-simulator-version-min=8.1 -bundle_loader /Users/Mazorati/Library/Developer/Xcode/DerivedData/exchangerate-fxnywlxmtfpaccbcpsmygvhirtma/Build/Products/Debug-iphonesimulator/exchangerate.app/exchangerate -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/Mazorati/Library/Developer/Xcode/DerivedData/exchangerate-fxnywlxmtfpaccbcpsmygvhirtma/Build/Intermediates/exchangerate.build/Debug-iphonesimulator/exchangerateTests.build/Objects-normal/x86_64/exchangerateTests.swiftmodule -Xlinker -dependency_info -Xlinker /Users/Mazorati/Library/Developer/Xcode/DerivedData/exchangerate-fxnywlxmtfpaccbcpsmygvhirtma/Build/Intermediates/exchangerate.build/Debug-iphonesimulator/exchangerateTests.build/Objects-normal/x86_64/exchangerateTests_dependency_info.dat -o /Users/Mazorati/Library/Developer/Xcode/DerivedData/exchangerate-fxnywlxmtfpaccbcpsmygvhirtma/Build/Products/Debug-iphonesimulator/exchangerateTests.xctest/exchangerateTests
Error:
ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks'
Click on your project (targets)
Click on Build Settings
Use the arrows next to your project name (right above the Basic and All buttons) the change to the Tests target
if the warning is ...for option '-L/... thats Library Search Paths, delete the stuff there
if the warning is ...for option '-F/... thats Framework Search Paths, delete the stuff there
Clean
Build
The warning i was getting was this:
ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/Developer/Library/Frameworks'
My Framework Search Paths were empty so updating/deleting this + Clean + Rebuild did not work for me...
If you are in this situation, try deleting your projects test target.
I got this warning together with 44 errors about about classes not valid for i386. What helped for me was:
product clean
close Xcode
remove all files from ~/Library/Developer/Xcode/DerivedData
I receive this error when opening files from their destination in finder. However, if I open the project from X Code it works fine.
Project 'Test' file delete to solution this app.

Xcode plugin template cocoapods

I want to create Xcode plugin, and I choose Xcode Plugin Template from Alcatraz, then i close project add Podfile open workspace and try to build i get ann error every time:
ld: library not found for -lDTXcodeUtils
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here is a full output:
Ld /Users/jakubmazur/Library/Application\
Support/Developer/Shared/Xcode/Plug-ins/CreateFilesPlugin.xcplugin/Contents/MacOS/CreateFilesPlugin
normal x86_64
cd /Users/jakubmazur/Developer/CreateFilesPlugin
export MACOSX_DEPLOYMENT_TARGET=10.10
/Users/jakubmazur/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-arch x86_64 -bundle -isysroot /Users/jakubmazur/Desktop/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
-L/Users/jakubmazur/Library/Developer/Xcode/DerivedData/CreateFilesPlugin-dmzpluimftctcqhbkndjiknqtjnz/Build/Products/Debug
-F/Users/jakubmazur/Library/Developer/Xcode/DerivedData/CreateFilesPlugin-dmzpluimftctcqhbkndjiknqtjnz/Build/Products/Debug
-filelist /Users/jakubmazur/Library/Developer/Xcode/DerivedData/CreateFilesPlugin-dmzpluimftctcqhbkndjiknqtjnz/Build/Intermediates/CreateFilesPlugin.build/Debug/CreateFilesPlugin.build/Objects-normal/x86_64/CreateFilesPlugin.LinkFileList
-mmacosx-version-min=10.10 -ObjC -lDTXcodeUtils -lXcodeEditor -fobjc-arc -fobjc-link-runtime -framework AppKit -framework Foundation -lPods -Xlinker -dependency_info -Xlinker /Users/jakubmazur/Library/Developer/Xcode/DerivedData/CreateFilesPlugin-dmzpluimftctcqhbkndjiknqtjnz/Build/Intermediates/CreateFilesPlugin.build/Debug/CreateFilesPlugin.build/Objects-normal/x86_64/CreateFilesPlugin_dependency_info.dat
-o /Users/jakubmazur/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/CreateFilesPlugin.xcplugin/Contents/MacOS/CreateFilesPlugin
ld: library not found for -lDTXcodeUtils clang: error: linker command
failed with exit code 1 (use -v to see invocation)
Any idea what should i set to do this?
Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :osx
pod "DTXcodeUtils"
Do the following steps. Its a work around.
Remove all the scheme and add by clicking auto create schemes.(The pods schemes will be checked once its recreated, need it checked for working it).
Then remove the scheme file from copy bundle resources(is it shows an error).
Deep clean and run
Its building without any error for me, Not sure whether it shows any run time errors/ exceptions

Resources