Monday, March 19, 2012

Making Quick Use of NSLog

This post has a lot of helpful pointers on using NSLog with Objective-C to dump objects and structures to the debugger console.

http://stackoverflow.com/questions/550195/is-it-possible-to-nslog-c-structs-like-cgrect-or-cgpoint

For those of us used to using Android logging away with "ToString()" methods is second nature and this is how I have been debugging / tracing my iOS applications.

I do appreciate that you can use IFDEF and DEBUG to control the code.


NSLog(@"%@", NSStringFromCGPoint(cgPoint));

...

NSStringFromCGPoint  NSStringFromCGSize  NSStringFromCGRect  

Monday, March 12, 2012

COCOS2D AND XCODE

I have been testing out Cocos2d and after installing it xCode started going crazy.

'New File' started crashing


I have installed cocos2d 1.0.1 on xCode 3.2.6, everything is okay, templates are installed and HelloWorld project compiles successfuly.
But when i need to create a new class,after clicking on "New File" i will get this error twice:
File: /SourceCache/DevToolsIDE/DevToolsIDE-1760/pbxinterface/Wizards.subproj/PBXWizardChooserWizard.m
Line: 1158
Object:
Method: _addWizardProxiesFromBaseSearchPath:subpath:
Assertion failed: _currentMultiWizard == nil


I had to delete any folder called cocos2d in both my user and system Libraries:

/Library/Application Support/Developer/Shared/Xcode/File Templates/



Adding References to Libraries in XCode

It did not work the way that I thought it would.

The tutorial I found that got me past the obvious issues was this:
http://www.theappcodeblog.com/2011/03/07/db-app-tutorial-part-1-create-a-database-using-sqlite/

This tutorial also helped:
http://www.techotopia.com/index.php/An_Example_SQLite_based_iOS_4_iPad_Application_(Xcode_4)

And this post was very, very useful figuring out which strategy to go with:
http://www.cocos2d-iphone.org/forum/topic/9308

First iOS Bug Cycle

I ran into a compile error today working on an iPhone application using Cocos2d.

The error was:

[CCTouchDispatcher addTargetDelegate:priority:swallowsTouches:]: unrecognized selector sent to instance

and I entered that into Google.

A few results down I found this link:

Which shows a fix that is totally irrelevant to my issue.

I later figured it out on my own. Learning iPhone development so far is fun, but slower than Android.