XCode Objective-C - Legacy to Modern [duplicate] - objective-c

I'm trying to compile sources with Xcode 4.6, for 32bit architecture, but getting this error:
error: -fobjc-arc is not supported on platforms using the legacy runtime
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
What's wrong?

You're mixing ARC (automatic reference counting) with the older Objective-C 1.0 runtime, which does not support ARC.
32-bit apps on OSX, automatically use the 1.0 Runtime, so you'll have to disable ARC for your project, and use Manual Reference Counting.

This problem recently resurfaced because Xcode 5 removes the ARCHS parameter - if you let it. But if you have a build server with Xcode 4 this defaults there to building 32 and 64 bit, which fails if you have ARC enabled.
See my writeup for a more detailed explanation.

Related

xCode 6.3.2 - arm64 Conversion

What is quickest way to convert old iOS Application written in ObjC to arm64.
When I updated valid architectures to arm64, I get tones of errors, framework missing, clangs.
Do xCode 6.3.2 Provide any help in conversion?

Objective-C ARC and Legacy Runtime compiling error

I'm trying to compile sources with Xcode 4.6, for 32bit architecture, but getting this error:
error: -fobjc-arc is not supported on platforms using the legacy runtime
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
What's wrong?
You're mixing ARC (automatic reference counting) with the older Objective-C 1.0 runtime, which does not support ARC.
32-bit apps on OSX, automatically use the 1.0 Runtime, so you'll have to disable ARC for your project, and use Manual Reference Counting.
This problem recently resurfaced because Xcode 5 removes the ARCHS parameter - if you let it. But if you have a build server with Xcode 4 this defaults there to building 32 and 64 bit, which fails if you have ARC enabled.
See my writeup for a more detailed explanation.

iOS 6 Project gives #synthesize error when deployment changed to iOS 5.0

When i ran my iOS 6 Project on an older xCode using iOS 5.0. It issues warning and fire exception on executing project.
Property 'window' requires method 'window' to be defined - use #synthesize , #dynamic or provide a method implementation
what is the science behind it ? why do i need to explicitly add #synthesize in 5.0. while it works fine in iOS 6.
This has nothing to do with iOS 6 or iOS 5. This has to do with the version of the compiler used in Xcode. The latest versions of the compiler, used in the latest version of Xcode, support many new features not found in older versions of the Objective-C compiler. One of those features is no longer needing an explicit #synthesize statement. Once you take advantage of these newer features, you can't use an older version of the compiler to compile your code.
So now the question becomes - why are you trying to build this project in an older version of Xcode? What is your goal? Why not use the latest Xcode and simply change the project's Deployment Target to iOS 5.0 and leave the Base SDK as "latest".

Xcode 4.4 + OSX 10.5 as Development target = Clang LLVM 1.0 error

Try this on the new Xcode 4.4: create a new project, a Cocoa application, and set the Development Target to OSX 10.5.
If you run it, you'll get this error:
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
Can someone explain this? I want to support Leopard too in my projects but I get this error if I try to execute them.
Make sure your project does not use ARC. ARC is not supported on Leopard.
(It is supported on Snow Leopard, sans weak references)
The actual error, btw, is probably before the line you copy/pasted in your question.

ARC enabled App will run in lower version of ios

I have developed an application using xcode 4.3.2 with ARC enabled ,my app users having ios3.2, ios4.0,ios5.0 devices how can I give support to lower version ios device uses .Should I need to do anything in code side . or Is there any way set ARC dynamically like.
Any have any idea regarding this plz share with me.
Thanks
ARC is not device- or OS-dependent (see note below). It is a LLVM compiler feature (which can be disabled using the -fno-objc-arc compiler flag). The compiler manages the memory instead of the programmer. The final executables will not be very different from one another and will work on the minimum OS specified for your project (if you are not using ARC-specific keywords, etc.).
Note:
According to Apple's Transitioning to ARC Release Notes from Apple, ARC-compiled executables will only run on iOS 4 and above. In addition, weak references are only supported on iOS 5.
Just set the target deployment to the lowest iOS version your users might be on.. AutoMatic Reference Counts only while compiling the app in Xcode. The memory of app enabled ARC is managed by compiler (Xcode). So you need not to worry about the target iOS version of the device. Just set the Target Deployment to 3.2 or 4 etc.
I think at least it is not guaranteed to work correctly on iOS 3.x. See Transitioning to ARC Release Notes from Apple:
ARC is supported in Xcode 4.2 for Mac OS X v10.6 and v10.7 (64-bit applications) and for iOS 4 and iOS 5. Weak references are not supported in Mac OS X v10.6 and iOS 4.