I'm trying to upgrade my iOS project to using ARC.
When starting the conversion via Edit -> Refactor -> Convert to Objective-C ARC, I select my target, deselect linked libraries and press check.
Next I get the following error:
clang: error: argument unused during compilation: '-ccc-arcmt-check'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
Some idea how to resolve this? Xcode does not even try to start converting the source files.
Note that I've got several targets in my project file sharing some source files. The conversion dialog only displays the target set in the current scheme.
I've already successfully converted another (static library) project, so the Xcode setup should be ok.
EDIT: I've activated Continue building after errors in Xcode's preferences, at least now I see all ARC errors. Let's see if this lets me convert to ARC.
EDIT2: I get this error for every source file of my target, I do not want to use ARC for - so it seems as if the compiler has a problem with concurrent flags -ccc-arcmt-check and -fno-objc-arc.
I found it out: Turn off Treat Warnings as Errors in Project Settings.
Related
I created new data model and then added 2 entities (Person, Address), but could not compile with "Linker command failed with exit code 1".
Why does it occur like this ? I don't know the cause.
when the entities are deleted, build succeeded.
please let me know how to remove this error.
Ver: Xcode 8.3
Lang: Objective-c
Linker error means that although your source files have been compiled correctly, but failed to link with other frameworks (system frameworks, or 3rd party ones), clang cannot find them in place.
Check this answer, it may help you.
Go to build phases -> Make sure all .m files are listed in compile sources list
Also , Try clearing all derivied data -> Clean -> Quit Xcode -> Restart -> Run Again
Also make sure you didn't imported a .m file instead of .h file anywhere
I usually work a lot with Objective-C and sometimes I do have multiple files that represent multiple classes.
Sometimes program run and sometimes I get this error:
linker command failed with exit code 1 (use -v to see invocation)
What is the reason for this error? There were different solutions reported in the forum but I want to understand what is the reason to avoid.
The general idea of compiling a program consists of separately compiling each file, and then linking the compiled binaries together. When it says linker command failed it means linking the binaries failed. What the linker error is depends on what the error says. Usually inside the junk there are a couple useful lines that can help you figure out what the issue is. A couple that comes to mind is when a function is defined twice, when a function is called but isn't declared anywhere, or when you import a library that contains a main function (which means main is defined twice) etc.
There are a lot of possible reasons behind this. I list some of those that I experienced.
You accidentally imported a .m file inside a .m file.
The libraries you linked have the same class name and it will cause a conflict.
The libraries you linked are built with different settings(e.g. the target iOS version, code signing, etc.)
The libraries you linked are built for simulator then you used it on a real device.
You forgot to put a semicolon in the end of a declaration in Localizable.strings
I am going through the process of updating my swift project to Swift 2.0 on Xcode 7. The following error is being reported by xcode on building the project:
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
This happens on either SwiftyJSON or SwiftSpinner frameworks (the compiler seems to pick one first at random and fail, so the error gets reported intermittently on either or the other). I have updated these frameworks to their xcode7/swift2 compatible branches but the project still fails to compile.
Just wondering if this is a situation other people are seeing when upgrading their project with cocoa pods framework dependencies, or if this is a compiler bug
For others with a similar problem try this:
Open Console (not terminal) and choose All Messages. Then try to build your Xcode project and when it fails take a look in the list there with any message that could be related to Xcode.
I found a message like this:
01/10/15 10.24.17,808 Xcode[53145]: DVTAssertions: Warning in
/Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-8228/IDEFoundation/Playgrounds/IDEPlaygroundAuxiliarySourceCompilerOperation.m:311
Details: Unable to read diagnostics from file
"/Users/username/Library/Developer/Xcode/DerivedData/OurProject-diexylwajzhwgtfqdwiphjgzdwcy/Build/Intermediates/OurProject.build/Debug-iphoneos/OurProject.build/Objects-normal/armv7/CheckoutUserDataAdapter.dia"
(Invalid File): Invalid diagnostics signature Function: void
XCGenerateDiagnosticsFromFile(NSString *__strong, NSString *__strong,
NSDictionary *__strong, NSDictionary *__strong,
IDEActivityLogSectionRecorder *__strong, BOOL
(^__strong)(IDEActivityLogMessage *__strong)) Thread: {number = 250, name = (null)} Please file a bug at
http://bugreport.apple.com with this warning message and any useful
information you can provide.
This gave us info that the error was in CheckoutUserDataAdapter.swift.
After trial and error we found that the problem was it was calling a method from its super class that it overrides from its super class. Somehow it could not find the correct method. We fixed it by adding super.methodCall() in CheckoutUserDataAdapter.swift - but that of cause should not be needed. I have filed a bug report.
Check Build Phases - Compile Sources for deleted files, or files with a blank icon, once this file was removed the error was gone
Thanks #Dug for the Build Phase tip. I ended up going a different direction than the deletion...
After checking Build Phases - Compile Sources, find the files that are grayed out (don't currently have a link to an actual file) to identify the files in question.
If the files are still being used, then find them in the Project Navigator (left hand column) and you'll see that they're colored red because Xcode only has a reference and not a location for the actual file.
Select each red file and then head to the File Inspector (right hand column). You'll see "Location". Locate your files by clicking the gray folder and finding them in the file structure outside of Xcode.
If you're working with a repo, you may find it easier to simply remove the red files, choose File > Add Files to... and simply re-add them so the link is more generic rather than pointing directly to your machine's file location.
This happened to me after a project file merge in which I'd been branched from the main repo for quite a while so a handful of file locations were lost in the merge.
I have an iOS app on Xcode 4.6 and when I recently tried to build and run in the iPhone 6.1 simulator I got a "Mach-O Linker Error." It continued to say:
ld: 17 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Does anyone know how to solve this?
Thanks so much!
Just go to "Build Phases" -> "Compile Sources" and look for duplicate of classes.
Check if you have "*.m" files in your #import ! It appears that was my mistake...
Quit Xcode
Restart the System
Select Xcode -> Preferences -> Locations
In Locations, you will see 'Derived Data'. Click on the arrow icon right next to the path.
This will open a folder containing 'Derived Data', delete it.
Clean the Product and Run
if still not works then
Build Settings > Enable Bitcode > No
In my example, I declared
extern NSString const *keyString
in two different files. I renamed one of them and it solved my problem.
In my case it was constants.
NSString *const cellID = #"cellID";
This line was written in two .m files. After appending static keyword at the start the problem was resolved.
This issue can be recreated in a new project too. You would think that defining constants in the different .m files won't have any effect as they are private. But I don't know how the compiler is handling stuffs behind the scene. On top of that when you tap the issue from issue navigator it doesn't open up a page in the editor like it does for any other issue. Really frustrating.
I am not sure I can give you a solution but I will share an answer since the same happened to me on xCode 4.6 as well. I added a C class header and implementation file and included them in main. I then decided to delete that new C Class header and implementation. When I ended up adding a new c class/header again with the same name and function calls, I ended up with your error.
Frankly, this might be a bug. The only and fastest way I fixed it was to start a new project and pull all the classes in.
Make sure you don't have non-instant methods with the same name in multiple classes (So for example if I have two viewcontrollers that are pretty similar so to move quickly I copy and paste the code from one viewcontroller to the second and they both have methods called the same thing like: NSMutableString *filteredStringFromStringWithFilter(NSString *string, NSString *filter)) then the app gets confused which of those methods to use since they are both available, RENAME IT on the second class and change any calls to that method on that class and you've removed the confusion. Don't we all want things to be more clear!
If you want to change a value both in tow different class. Do remember to mark with static keywords.
or the clang will throw such error below without any value interpretation。
Apple Mach-O Linker Error
clang: error: linker command failed with exit code 1
When you refactor a class func you will also sometimes get this error. Just go to Product-> Clean and rebuild.
Build Phases" -> "Compile Sources" click the button "Validate Settings"
it's will fix your project
I dont know what happen here when I tried to compile with Xcode, the compiler show this statement, "Apple LLVM compiler 3.0 error". It says fatal error that:
file '/Users/integraasp/Dropbox/code/FlipView/Classes/ColorHelper.h' has been modified since the precompiled header was built. It can build and run well on device but I can't test my code on simulator.
Before I got this error, I tried to copy the newest version of my code from dropbox. I don't know what to do since I've changed many line of code.... :'(
I've tried solution from these link, but unfortunately it's not work at all. Is there anyone can help me..? :(
Convert to ARC - LLVM compiler 3.0 Error
LLVM 3.0 compiler error: cast of C pointer type to Objective-C pointer type 'id' requires a bridged cast
**
Finally, I've found the error. :)
**
Well, finally I've found the error. prefix.pch file for this
project declare was not correctly write all of header files of this project. I just
write down manually on prefix.pch all header files from my project
and it's done. :)
Cleaning build folder i.e. Option+Command+Shift+K, not just Product>Clean for the project usually solves this problem.
try following step.
Set the project compiler to "LLVM GCC 4.2", instead of "Apple LLVM 3.0"; ARC is only supported when you use Apple LLVM. To set the project compiler, in your Project, under "Build Settings", and then under "Build Options", there is a settings for "Compiler for Objective-C". Change that value to "LLVM GCC 4.2