Project refactored to suppport ARC now while building the project getting error "language not recogonized ml2" - objective-c

My project was perfectly building before it is refactored to support arc. Now when the refactoring is applied, it is not building and an error message is shown that language not recogonized. Any work around for this?

The linker command line shows an option "-xml2", which is wrong. You have to find and remove that option from the "Linking" options in the build settings.

Related

Reference to ' ' is ambigous error in Xcode

I was working with a custom iOS framework project in Xcode.There I am getting a lot of errors mentioning "Reference to ' ' is ambigous".I am attaching the screenshot of errors.Please help me correcting this.
Adding more information to Jason's answer.
The error message makes me think you have two declarations of the same library functions. All of those references are from UIKit
mostly this can be occurring because of the header files. As you can see all the errors indicates that it is quoting the enum values. Enum values will always be in the .h files. Normally the reference headers(.h files) will be present inside the frameworks. It is a common mistake that sometimes these header files will be buried some where in our code by any third party frameworks. So kindly check your third party libraries.
I did face this issue once and after searching everywhere i could not able to find the solution. The only thing solved my issue was
Opening a fresh project and importing my files into that project. Actually it really took me less than 10 minutes to move to a new project and immediately my xcode was happy. This is definitely worth a try.
Actually This error was cleared when I shift from iOS SDK 6.1 to 7.1(or any version higher that 6.1)
The error message makes me think you have two declarations of the same library functions. All of those references are from UIKit. Check to make sure only one version of UIKit is referenced in your project (check the frameworks), and make sure any libraries you have included are linking the same UIKit version as the rest of the app.
Steps to fix from here:
Clean the project
Delete everything inside
'~/Library/Developer/Xcode/DerivedData/ModuleCache/' (the button
inside the organizer window did not work for me)
Clean once more
Build project
from here: Reference to 'X' is ambiguous
Clean your project and rebuild again.If it don't work then create a new project
Set value of Enable Module (C and objective-c) to No

jsonkit user defined issues and arc restrictions on trying to import it from objective c

So it's my first time to try and use jsonkit. I've been looking for the past hour and couldn't find any installation instructions so I just tried copying and pasting the files and then adding them into the xcode project and then import them. But when I compile it would throw a dozen errors, which would usually have ARC restrictions on it. One of these errors has this :
JSONKit does not support Objective-C Automatic Reference Counting
With that said, are there any specific instructions I need to follow for this to compile properly? Or maybe point me to the right direction?
Thanks!
This is Happening because here you are mixing the non-arc Code in ARC Code,that's why this error is coming.You can use below idea of mine and it works fine , have used the same in past
.
Hey You can Disable ARC for JSON classes by just set a flag in under the Build Phases of App setting.
and the flag is
-fno-objc-arc
As Below Image depicts the Way how to do this.
It would work with charm..!!!!

Static library with ARC support linked to non-ARC project causing linker errors

I have a non-ARC project that uses an ARC-enabled static library. This is a supported scenario, so that everything works fine. That is, until I run the code on a 4.x device, including the Simulator. In that case the code blows up with the following linker error:
dyld: lazy symbol binding failed: Symbol not found: _objc_storeStrong
Referenced from: /Users/zoul/Library/Application Support/iPhone Simulator/4.3.2/Applications/…/Demo.app/Demo
Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation
This happens as soon as some of the ARC-enabled code attempts to call _objc_storeStrong function, like in an init method (self = [super init]). Converting the main project to ARC solves the problem, but I’d like to know if there are other solutions.
I assumed that the toolchain may have added the necessary libraries to link to, in order for ARC to work properly. So the linker transcript may contain this piece of information. If the project of the app itself is not ARC-enabled, you may not get these by default, but you could still link to them by defining them explicitly.
Looking at the build transcript you can indeed find the appropriate linker flag there: it’s called -fobjc-arc (just as the related compiler flag). When you add this setting to Other Linker Flags, the linker will include the ARC library with the main build product and the code should run fine.
I'm adding a new answer to this as the previous accepted solution no longer appears to work with Xcode 4.3.2. I can only assume that the -fobjc-arc linker flag was never supposed to be exposed and has now been removed.
This appears to be a known issue although the only thread I can find on this with somebody from Apple commenting on the devforums dates back to mid-2011. From that thread, it is suggested that manually linking the following file solves the issue:
${DEVROOT}/Platforms/iPhoneOS.platform/Developer/usr/lib/arc/libarclite_iphoneos.a
This requires you to be compiling using the latest compiler/SDK though. I'm submitting this answer without testing, please upvote if it works, downvote if it doesn't!

Xcode Real-time Syntax Checking?

I'm new to Xcode and Objective C, but I'm digging my way through the IDE and noticing that it doesn't appear to do live syntax checking. If I make a typo, I have to build the project before Xcode will even mention that there's a problem. Worse still - since it's returning compiler errors, it's usually not even the (in)correct line that's highlighted!
Is there a setting that I'm missing, or is that just what I'm stuck with compiling to check for syntax errors?
Assuming you're using Xcode 4.*, go to Preferences -> General, select "Enable Live Issues".
Select Target from TARGETS Navigator, select Build Settings, LLMV CLL 4.2 - Language > change Precompile Prefix Header setting to "NO", re-open Project (Workspace). It's worked for me.
Make sure you're on the current release of Xcode 4. Despite the 4-ish-ness of its version number, it was a complete rewrite from the previous release, and the early editions of it were sketchy, especially in "code sense" features like syntax highlighting and live error checking.
I've been much happier with it in its last few releases.

Getting: "Compilation exited with code 134" when attempting to use "LLVM Optimizing Compiler" switch

I'm getting a "Compilation exited with code 134" when attempting to use the "LLVM Optimizing Compiler" switch for release iPhone builds, using MonoTouch 4.0.1.
I don't get much information from build output window at all - just:
"Compilation exited with code 134, command:"
MONO_PATH=(snip)/bin/iPhone/Release/LSiOS.app /Developer/MonoTouch/usr/bin/arm-darwin-mono --llvm --aot=mtriple=armv7-darwin,nimt-trampolines=2048,full,static,asmonly,nodebug,llvm-path=/Developer/MonoTouch/LLVM/bin/,outfile=/var/folders/03/033pAAGuHgGkIy4CorbVV++++TI/-Tmp-/tmp38107451.tmp/Newtonsoft.Json.MonoTouch.dll.7.s "(snip)/bin/iPhone/Release/LSiOS.app/Newtonsoft.Json.MonoTouch.dll"
Mono Ahead of Time compiler - compiling assembly (snip)/mscorlib.dll
What is odd is that in earlier command lines, there is a correlation between the DLL mentioned in the arm-darwin-mono command line and what is the compiling, but in this case it says "mscorlib.dll".
Any thoughts?
I have found a few cases (googling and from bugzilla.xamarin.com) where the error code 134 is related to Mono.Linker being too aggressive (removing something that's needed).
This is easy to confirm by turning off the linker, i.e. "Don't link" in Linker Options. If the build works then you can try isolating the assembly where the linker makes a mistake.
E.g. add a "--linkskip=mscorlib" to the mtouch extra parameters and re-enable linking. This will link everything (Link All) or all SDK (Link SDK assemblies) except the assembly you selected (mscorlib in the example). That's only a workaround and a bug report should be filled so the issue can be fixed properly (and get you all the linker advantages).
However be warned that there are other issues sharing the same error code, like:
http://ios.xamarin.com/Documentation/Troubleshoot#Error_134.3a_mtouch_failed_with_the_following_message.3a
YMMV
mtouch does its native builds in parallel so the logs can be confusing, e.g. you can see a bit of assembly X output followed by some assembly Y output.
Reading the full log might help you (or us) to pinpoint the issue.
I was having the exact same problem Scolestock. My app would build fine until I enabled llvm, then it was "Compilation exited with code 134, command" when trying to build the 7s for the app itself.
I'm elated to say that after 2 days of painstakingly whittling my app down to the core problem, I was able to isolate the issue to the usage of embedded dictionaries such as:
Dictionary<enum, Dictionary<enum, value>>
I was able to fix this by defining a class for the embedded dictionary and using that instead:
public class MyDefinition : Dictionary<enum, value>
{
}
...
public Dictionary<enum, MyDefinition>
Not sure if this will help you, but hopefully it'll help some poor soul who decides to use embedded dictionaries and runs into my same problem.