I just released a compatibility update for Kobold2D since there were numerous compiler warnings and errors introduced in Xcode 4.4.
Almost all of the issues were simply the compiler being more adamant about using the correct type specifiers in format strings. For example using %i for an unsigned integer or %u for an unsigned long type would bring up warnings. The solution is to use either the correct format specifier or casting the value. The latter is preferable if the underlying type changes depending on the platform. For example NSUInteger is unsigned int for iOS but on Mac 64-Bit it’s actually unsigned long.
You can get the updated Kobold2D v1.1.2 and v2.0.3 versions from the Kobold2D Downloads page. Continue reading »
While Cocos2D is compatible with ARC, simply enabling ARC in the project’s Build Setting will throw several hundreds of errors in your face. Cocos2D doesn’t provide ARC-enabled project templates. Thus this tutorial about how to enable ARC in a newly created Cocos2D Xcode Project.
While none of these steps are overly difficult, you’ll notice there’s plenty of steps to perform. Unavoidably, and on the off chance you don’t already know, I’d like to recommend Kobold2D to you if you want to write ARC enabled Cocos2D apps. Because none of the steps below, really zero, zilch, nada, niente, keine are necessary to enable ARC in Kobold2D. That’s because it ships with 15 template projects all of which have ARC enabled out of the box. And Kobold2D 2.0 with cocos2d-iphone 2.0 is just around the corner.
Self-advertisment aside, these steps are tested with cocos2d-iphone v2.0 but should also work with cocos2d-iphone v1.1 - but admittedly I haven’t tested the process with the v1.1 version. If you find anything that’s not quite working with v1.1 please leave a comment. Preferably with the solution, that’ll be awesome!
UPDATE: I released a video version of this tutorial: Continue reading »
Kobold2D v1.0.4 is available from the Kobold2D Download page!
I’m terribly sorry for the hiccup with v1.0.3. There was an absolute path causing build failures for others, which of course worked on my systems so I didn’t catch it. I retracted v1.0.3 shortly after publishing it. The fixed version is now v1.0.4. If you happen to have downloaded v1.0.3 I recommend to upgrade to v1.0.4 right away.
The most important improvements in this version are Xcode 4.3 compatibility and working around a “file not found ../libkobold2d-ios.a” issue caused by the Xcode 4 Build Location setting “Locations Specified by Targets” (in Xcode 4.3 this setting is now appropriately named “Legacy”).
The Release Notes lists all the changes. Continue reading »
I have no doubt that automatic reference counting (ARC) is the next big leap forward for Objective-C since the introduction of Objective-C 2.0. ARC allows you to put the burden of memory management on the (Apple LLVM 3.0) compiler, and never think about retain, release and autorelease ever again.
Since many user’s first experiences with ARC will be trying to convert an existing app, they will learn the hard way that converting existing code to ARC is not a fire & forget operation. And since this is the Internet, there’s also a lot of assumptions, false statements and other myths revolving around ARC going around.
So here’s just about everything you need to know about ARC, and some ARC-mythbusting too.
- Development Requirements for ARC apps
- Minimum Deployment Targets for ARC apps
- Required Deployment Targets with zeroing weak references
- How to enable ARC in your project
- Compile errors after switching to LLVM 3.0
- Getting third party libraries to build with ARC
- Converting an existing app to ARC
- “Cannot Convert to Objective-C ARC”
- Fixing pointer types in C structs
- Fixing C/C++ pointer transfers with bridged casts
- Fixing NSAutoreleasePool with @autoreleasepool
- Methods you can’t call (or override) anymore
- You can still override -(void) dealloc {}
- Property naming restriction
- New Property keywords: strong and weak
- ARC forbids synthesizing a readonly property without ownership qualifier
- For experts: detecting at compile-time if ARC is enabled
- For experts: allow use of ARC keywords with ARC disabled
- Myth: ARC has not been proven reliable
- Myth: ARC takes away control over Memory Management
- ARC Reference Documentation
Whaaaaaat?
You heard right: if you want to forget about using retain, release and autorelease in your code, then the newly introduced automatic reference counting (ARC) mechanism (aka “automatic memory management”) is the way to go. And guess what?
Kobold2D Preview 6 fully supports ARC out of the box!
You may have heard that Cocos2D is incompatible with ARC at this time, and you’re right. However, the Cocos2D version in Kobold2D Preview 6 released just now has been improved to work with ARC. This post explains the most important changes to make Cocos2D compatible with ARC. All 15 Kobold2D example projects compile with and without ARC, just like the other libraries Kobold2D makes use of!
To put it in Apple’s words: “Taking Cocos2D to a whole new level.” I can’t brag with 200+ new features though I have a few in store that should make a big bang for no bucks! 😀
So, here speaketh the market crier for Kobold2D. What’s new and noteworthy about this version of Kobold2D, you ask?
Built-In Gesture Recognition
Recognizing gestures has never been this easy. No (speak: zero) iOS SDK knowledge required! All gesture recognizers provided by the iOS SDK are implemented:
Tap, Double-Tap, Long-Press, Swipe, Pan, Rotation and Pinch.
What do you do if your app doesn’t behave as it should, or even crashes?
Answer A: Post your problem in just about every programming forum.
Answer B: Use the Xcode Debugger to analyze what’s going wrong.
Since most of you already know how to do A I’ll focus on B in this Xcode 4 Debugging Crash-Course. It’s kind of aimed at beginning Xcode developers but that’s just because I hope - against better knowledge - that experienced developers already know that … thing … that debugger stuff. Ya know?