Im using the GameCenterManger from Apple's GKTapper demo. I decided I want to convert my project to arc, but I keep getting an error saying "GameCenterManager.h:67:43: The current deployment target does not support automated __weak references". Any help would be appreciated, thanks!
https://developer.apple.com/library/ios/#samplecode/GKTapper/Introduction/Intro.html
"Weak" not support iOS 4.0 target.
1st way...
if your project is newer. change target to iOS 5.0 or later.
2nd way...
You should support iOS 4.0.
You can use assign keyword.
But assign do not support setting to nil.
Related
I'm aware that with Xcode now, it is recommended to use ARC, however I've read a bit about it not being compatible with iOS 4.x, at least when using __weak. When I create an IBOutlet it gives the choice of weak or strong as the storage type, does this mean my application is limited to iOS 5 or above, or will it still run on an older iOS?
Definitely just use ARC. As you point out, if you elect to provide iOS 4.3 compatibility, you don't enjoy that one little benefit feature of weak variables, where they'd be automatically nil-ed for you when they're deallocated (but you don't have that feature in non-ARC code, so it's not like you're losing anything). And, yes, when you control-drag from Interface Builder to the .h file, it says you have only the strong and weak options, but in the latest Xcode, at least, if you have iOS 4.3 as a target and you choose weak, it will automatically create it for you as a __unsafe_unretained, so all is good.
In short, use ARC, even if you're targetting support for iOS 4.3, and your coding life will be considerably better than if you didn't use ARC. Even in iOS 4.3, you get so many wonderful ARC benefits. And if you are willing to use iOS 5.0 as your target deployment, then you enjoy the full benefits of ARC.
If you use Xcode 4.5, you do, admittedly lose support for armv6, the processor for the iPhone 3G and earlier, so your app will only support the iPhone 3GS and later.
No, ARC is just compiler feature. It's per file, so it wouldn't impact your existing code at all.
iOS version support depends on your Xcode version.
With the last version of Xcode (4.5) you can create apps for iOS 4.3 and higher. If you need to create apps for earlier versions of iOS (prior that 4.3) you need to install Xcode 4.4.1.
Has anyone converted the Apple MVC Networking sample to ARC?
http://developer.apple.com/library/ios/#samplecode/MVCNetworking/Introduction/Intro.html
As a new iOS developer I am very interested in ARC and attempted the conversion w/o success, sent a few emails to Apple, no response.
During the conversion there were some CF functions that I couldn't bridge correctly and there were all kinds of memory issues and exceptions.
Currently I don't have an example, just wanted to see if anyone else has been though the conversion, Google didn't help me out this time :)
Thanks
Just curious but why are you trying to do this conversion? If you are integrating this example into a project that already runs with ARC, you can exclude the source files that aren't ARC explicitly in the Compile Source section of your build phases in the Target.
If you want to try this, select the sources that don't have ARC and hit enter. A dialog should appear where you can enter:
-fno-objc-arc
Hope this helps.
XCode 4.3.2 has a new feature to convert projects to ARC.
Edit->Refactor->Convert to Objective-C ARC
Should get you going in no time!
I am using Xcode 4.2 and building a game for iphone (from iOS 3.0 - 5.0). Does cocos2d support ARC? What modifications needs to be made to convert code written in previous versions?
If I use the strong and weak keywords for variables and set compiler to LLVM GCC 4.2, what will be the results? Is it a necessity to change compiler to 3.0 to support ARC?
Cocos2d v1.1 and v2.0 are compatible with ARC. However, the cocos2d code itself does not use ARC and there are no templates provided by cocos2d that you can use to start programming with ARC. You are required to add a seperate static library target for the cocos2d files yourself.
As Ankit pointed out, Tiny Tim Games made the necessary changes to a forked version of cocos2d-iphone to make it ARC compatible. These changes have been integrated into the development version and should be available in the cocos2d v2.x branch. I've since written a tutorial to enable ARC in a cocos2d (2.0) project.
It was said that cocos2d itself will be converted to use ARC internally in v2.1 or v2.2.
It's important to note that there are no plans to officially support ARC in the cocos2d v1.x branch because the v1.x line is supposed to remain backwards compatible with 1st generation devices and iOS 3.x. But general ARC compatibility has been added to v1.1.
Kobold2D fully supports ARC and has it enabled in all 15 template projects for almost two months now. Kobold2D uses the latest stable versions of cocos2d-iphone 1.x and 2.x. Just start a new Kobold2D project and you're set to work with cocos2d and ARC.
Even though Cocos2d does not support arc but there is way in which you can use both of them together, and that is by cross project referencing. You can learn how to do it by refering this.. cocos2d and ARC
Even easier, just get my cocos2d-ARC template here: https://github.com/Elland/Cocos2d-iphone-ARC-template hassle free, just rename the project to your desired name and you're set :)
I just released my app but I am only able to make it compatible from 4.3 and up.
When I try to go any lower than 4.3 (xcode), it says I need to add code to make this work.
Does anyone know how to do this or has any suggestions? I would like my app to be compatible with 3.0 and onwards.
Thank you very much
You have to reach the least common code, what I mean by this is that you must find all the methods that are all incompatible within all of these versions of the OS. After that you will have to find each and every of it's functional equivalents. Then you can use conditional statements to check for every version and see what fits better or you can use the respondsToSelector method inherited from the NSObject class. In the end you have to test it on each device you are targeting :P
You can run this checkup list that I have always liked.
Edit:
I think I misunderstood your question though it has already been mentioned, be sure to check your deployment target in your build settings.
Checklist:
In your project's build settings…
Did you set the "iOS Deployment Target" to iOS 3?
Did you include the armv6 architecture in both, the built and the valid architectures?
In general:
Do you link to any framework that is not supported on iOS 3?
Do you use any methods, classes or other features that have been added later?
Hear a rumor that the new version of xcode is going to add the release statements for you.
So if I init something do I actually have to release it?
What you're referring to is called Automatic Reference Counting. ARC is a feature in recent versions of the LLVM compiler that will be included in a future version of Xcode. You have to specifically enable ARC to get the benefits from it, and it includes its own set of rules that you need to follow. Right now, unless you're compiling with a prerelease toolset, you need to do your own retains and releases. And even when the feature is released, you will need to specifically code for it — Xcode won't just helpfully correct your mistakes.