Project upgraded from Xcode 5 to 6 won't compile - ios

I upgraded from Xcode 5 to 6 and now my code won't compile. I found some similar issues from 3 to 4 but none for the newest version.
Here is the error I'm getting.
ld: building for iOS Simulator, but linking against dylib built for MacOSX file '/Applications/Xcode.app/Contents/Developer/Library/Frameworks/XCTest.framework/XCTest' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is there a common fix for this?
Thanks for any help.

I had a similar problem which was fixed by running clean (in menu under product/clean).

Edit 1:
Oh found issue with your build settings.
1.
How come the test file is linked with your project?
Just remove the "XCTest.Framework" file from Project Navigator > Targets > 'Project Name' > Build Phases.
Then, "Product" (drop-down) > Clean. Did it for me!
2.
Also
Project > Targets > 'Project Name' > Build Phases > Compile Sources
XCTest should not be included in your regular application code. So you should remove any Test Source from the Compile sources and move to Test Target.
You should update your 'Build active architecture only' to NO in Build Settings.
Restart Xcode and clean build.
Should work fine.

Sounds like you need to remove the XCTest framework from your project file and re-add it from the iOS frameworks.
Seems odd that your iOS project somehow got linked to a Mac framework during the upgrade.

Related

Xcode project giving pod file error for FIRAnalyticsConnector.framework . How to solve it?

I'm working on a book project and the project is connected by API . I'm working on the book app which has different libraries imported from the various places.
Recently, i cloned the project from bitbucket in Xcode and tried to run it. The result i got i error as follows:
enter image description here
It shows :
ld: in /Users/ishinfoservices/Documents/vadltaldhambooks/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector(FIRAnalyticsConnector_a8eeba373b74508311b8b22b8d3202a6.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/ishinfoservices/Documents/vadltaldhambooks/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Help needed to fix the error, as the project has lots of mixes of old libraries along with .h and .m files, the swift files with wireframes
According to the image I saw that you are trying run the app on the iOS simulator, then you could try to add the arm64 to the Excluded Architectures on the Build Settings section of your project or target, it would be like:
Take in mind that if you use Cocoa Pods is possible that also you should add the arm64 to the Exclude Architectures into the Pods project
After the above, clean, build and run the project on the iOS simulator, is possible that on your physical device you must remove the arm64 from the Exclude Architectures, it could depend on what you use in your project.
On the other hand, you can try the following: Select the project -> Select the target -> Go to the Build Phases -> Expand the Link Binary with libraries and add all pod libraries (remove if they exist in embedded binaries or Remove the old FrameWorks), after that, clean and build the project

Auto-Linking framework not found

I have forked a framework called BTNavigationDropdownMenu (swift project for ios). all worked fine till I tried to add a dependency to the latest version in the branch I created. the problem is the same whether I add the other framework (DYBadge) through a podfile or through Carthage.
Auto-Linking framework not found DYBadge.
It seems to have a problem with a UIView extension that is part of DYBadge.
DYBadge works fine in my main app I'm working on (I also need it in the app target).
errors below. thanks for any hints into the right direction.
ld: warning: Auto-Linking framework not found DYBadge Undefined
symbols for architecture x86_64: "(extension in
DYBadge):__ObjC.UIView.getBadge() -> DYBadge.DYBadge?", referenced
from:
Demo.BTNavigationDropdownMenu.updateBadge(text: Swift.String, at: Swift.Int) -> () in BTNavigationDropdownMenu.o ld: symbol(s) not
found for architecture x86_64 clang: error: linker command failed with
exit code 1 (use -v to see invocation)
Xcode is not able to find your frameworks because the FRAMEWORK_SEARCH_PATHS is probably not set or is wrong (happened to me because I moved the Info.plist file).
You can fix this by going into your target and adapt the Build Settings. Simply search in there for FRAMEWORK_SEARCH_PATHS and add the correct one, which is usually $(PROJECT_DIR)/Carthage/Build/iOS (for iOS projects). $(inherited) should also be in there as the first entry.
This is the post of #user3122959 answer in the comments, which helped me and others to fix this problem and was requested to put in as the answer to this question.
Try this process -
Press "Cmd + Shift + K" or shift + cmd + alt + k to clean up, and quit Xcode.
Delete the cache Run "rm -rf ~/Library/Developer/Xcode/DerivedData" in terminal
Open the project and re-build it
I had this problem accessing 3rd party frameworks from my tests. Here's how I fixed it.
In Xcode goto: Your Unit-Test target > Build Phases > Link Binary With Libraries
In Finder goto: Carthage > Build > yourframework.Framework
Drag the framework in to your build phases then clean (cmd - shift - K).
This can also be an error if you use a framework that has Bitcode Enabled on false.
Bitcode Enabled can only be true if all frameworks also have Bitcode enabled true.
Go to your targets build settings and disable bitcode.
For me this fixed it:
Go to Project > Targets > Build Settings (Tab) > Build Options (Heading)
Set Enable Testing Search Paths to Yes.
Instantly back up and running. Honestly not sure what this means but it worked.
If you are using Carthage and several Projects within one Workspace you have to add a symlink to your Main Carthage Folder. it will depend what structure you have, but for example if you have
Project -> Carthage
Project -> Frameworks -> MyImbaFramework than cd in terminal in MyImbaFramework folder and run
ln -s ../../Carthage Carthage
In my case, there was an issue with Bitcode, but Xcode couldn't give an accurate error diagnostic since the project framework references were also somehow messed up. Running the framework tests worked fine, but archiving gave the auto-linking error.
Deleted all framework references from the project, including the Frameworks group they were under, added them back again resolved the references issue, then I got the bitcode issue, which I disabled on the target framework, then and only then, archiving was successful
I had a similar error and none of the suggestions on this page worked. It occurred when trying to create an archive when pointing to my test iPhone, when I changed it to 'Any iOS Device' it worked correctly. I suspect this is related to the recent change to add support for Apple Silicon but I'm not certain how.
Make sure you haven't set a testfile that imports XCTest's TargetMembership to the main target, but to a test target :-)
Hope this helps someone, this is what worked for me
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf Pods
rm Podfile.lock
pod cache clean --all
pod install --repo-update
and cleaning the build folder
XCode > Product > Clean Build Folder
or
⌘ Command + ⇧ Shift + K
then closing XCode an clearing the derived data again
rm -rf ~/Library/Developer/Xcode/DerivedData
For me, the problem was that I had set the "Other Linker Flags" setting prior to converting my project to use Cocoapods. To fix this, I changed that field to use $(inhereted) and everything worked after that.

Debug scheme won't build - Apple Mach-O Linker Error. Linker command failed with exit code 1

ld: library not found for -lPods-AFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I get this error way too often and it's driving me (and the team nuts). The project was building just fine last week and I did nothing to the project in the mean time, just opened it yesterday and now I'm getting this error when building using the Debug scheme only; Adhoc builds fine. I'm running the latest Yosemite, Xcode 6.1 (but this has plagued me for many months anyway). My instructions to resolve it work occasionally, like black magic:
Clean
Restart Xcode
Delete derived data (check preferences/locations)
Pod update
Open project using the Workspace file
Delete the workspace file and run pod install
But unfortunately this time it's just not working! I've done this process over and over. I'm so frustrated with this PoS Xcode. Next step would be to re-download the project from Git, but there must be a better way! I have gone through a number of other stack overflow posts but found nothing to help (nor anything very recent). Thanks!
The same error drove me nuts for two days. I fixed through the following :
Project > Targets > Build Settings > Packaging > Product Name - Check if the product name has changed.
Also try setting the Build Active Architecture to NO in your project..
Project/Pods > Build Settings > Architectures > Build Active Architecture Only
Just delete the build folder of your project and rebuild it again. Always works for me!

Having issue with AR on iOS 7 and Xcode 5

I developed a project with ninevehGL engine and vuforia sdk , every thing worked fine on xcode 4 , and iOS 6 , but today I compile my project and got two different strange errors :
ld: warning: directory not found for option '-L/Users/MK/Documents/Xcode project /CarShowcase/Qualcomm'
ld: library not found for -lQCAR
clang: error: linker command failed with exit code 1 (use -v to see invocation)
or
Lexical or preprocessor issue 'QCAR/Tool.h' file not found
I checked header path and everything is OK ! but is there any solution to fix these issues ?
Lover,
Go to-> Target-> Build Phases -> Link Binary with Libraries,
Here you will see, your missing libraries in red colour, indicating the libraries not found, just remove these. & add gain using "+" button -> Add Other, and then locate the libraries. Hope this will help.

clang: error: linker command failed with exit code 1, only when testing on device

I was just about to test my app on a device when I ran into this problem, I'm getting this Linker Error.
I've already checked all my compile sources and Build Phases, but there's no sign of my importing things twice.
ld: duplicate symbol _calculateNextSearchPage in /Users/wouter/Sites/test/FastPdfKit.embeddedframework/FastPdfKit.framework/FastPdfKit(FastPdfKit) and /Users/wouter/Sites/test/FastPdfKit.embeddedframework/FastPdfKit.framework/FastPdfKit(FastPdfKit) for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This only happens when testing on a device, not in the simulator.
Alright guys I had the same problem. Seems like I fixed it.
I am using cocapods therefor the described standard procedure can not be properly executed.
Steps to do to properly add FastPDFKit with Cocoapods.
Download FastPDFKit
In your project Add Files to "Your Project"
go to FastPDFKit folder you just have downloaded
locate 1 folder and 1 project file. Press and hold Command key and add these in to your project
FastPdfKit.xcodeproj
FastPdfKit.embeddedframework
(Note: FastPdfKit.embeddedframework is the actual Framework and you
might want to open FastPdfKit.xcodeproj standalone before adding it
to your project, delete FastPdfKit.embeddedframework folder from
your disk and Build FastPdfKit target in the project. You should see
newly created FastPdfKit.embeddedframework folder)
Go to your Project Settings > Your target > Build Phases > Link Binary with Libraries
Make sure FastPdfKit.framework is there.
If not, drag it from the project and put it there.
Clean the project, delete derived data
Add #import <FastPdfKit/FastPdfKit.h> where you need it and you are good to go.
Here is how my Link Binary with Libraries look like
Please let me know if you have any troubles I might've missed something.
Try to delete duplicate files/images which are in target-> Build phase -> Compile files, Copy bundle resources

Resources