XCode tip: NSZombie!
If your app is having mysterious errors and mysterious crashing, try enabling NSZombie. It will basically keep a “zombie” pointer to any object you release. Thus, if your problem is releasing an object that has already been release, enabling NSZombie will help you to debug where in the code this happened.
To enable NSZombie:
- In the menu bar, go to Project>Edit Active Executable
- Click Arguments at the top
- Add a Variable to be set named “NSZombieInfo” with value “YES”
- Make sure the check box is checked
The log will, hopefully, now give a more useful error. Good Luck!
Oh, and don’t forget to uncheck that box. It would be bad news to release an app with a bunch of extra NSZombie pointers.
Passing BOOL in a selector method.
BOOLs cannot be passed as objects for selectors because they are primitives. Rather, they must be wrapped in an NS object such as NSNumber:
[self performSelectorOnMainThread:@selector(didFinishSendingStatusUpdateSuccesfully:) withObject:[NSNumber numberWithBool:success] waitUntilDone:NO];
To unwrap a BOOL just use the boolValue class method of NSNumber:
There you go, simple and easy.
iPhones will be delivered on time?!
After getting a very sad email from Apple containing a projected June 23 delivery date for my iPhone 3GS, I gave their support a call to find out what exactly was going on. The first person I spoke with said, “Yeah, sorry. Nothing I can do!” However, the second customer support rep assured me that I will have the phone in hand tomorrow. In fact, he claimed that any phone ordered before yesterday would arrive tomorrow. That’s quite a guarantee, and hopefully one that Apple can stand by.
I wish I knew the source of all this confusion, but I’m more than happy to believe the second guy.
Here are some links to more info on all this confusion :
I received an email from Apple today saying that my iPhone had shipped. However, rather than the Friday, June 19th delivery which had been guaranteed when I ordered, the email contained an estimated delivery date of Tuesday June 23rd. It’s four days late! I am, needless to say, very unhappy about this. :(
On a lighter note, I just finished CS193P lecture 10 on memory and threading. Really interesting stuff!
edit: Rumor has it, this has been happening to many who ordered the 32GB version.
The iPhone has about the processing power/memory of an eight year old computer (said Alan Canastraro). Thus, we need to load things as gradually as possible.
If you have more than one view controller, use more than one NIB! Putting everything in one NIB is a mistake I’ve seen people make on a lot of forums. Not only is CocoaTouch/Interface Builder not made to work this way, but it will really stress out the device.
Also, think about what will be most processor heavy and only do those things when they are necessary in the app. These things include:
- Complex Graphics
- Initializing large arrays
Basically, only call a method when it is absolutely necessary.
Now I’m going to try to rewrite my Presence 2 assignment so that all the images don’t load first thing :/
iPhones won’t be delivered early
It looks like the iPhone orders which were scheduled on UPS tracking to be delivered before the 19th will have to wait after all. Too bad for all the almost lucky future 3GS owners. However, I’m sure this gives everyone who wasn’t going to receive theirs (me?) early a sick sense of satisfaction. ;)
My very first iPhone is arriving on Friday. I can finally stop borrowing!
OMG Presence2 assignment for CS193P
Tips for an Absolute Beginner
I recently (as of this summer) started doing iphone development after taking an intro to object-oriented programming class in Java. I’ve been following along with the stanford course on iTunes U, CS193P. I’m on lecture 10 and so far it’s been very informative. I highly recommend it. My only qualm is that I have no way to get my code evaluated.
Here are some tips for someone just starting out on the platform from someone just starting out:
- Don’t get too bogged down with design patterns at first, the frameworks are designed in such a way that you will kind of learn them as you go.
- Do, at least, the first 6 courses of CS193P (along with the assignments)! They will help a lot.
- Think about the architecture of your app before you start but be willing to make changes down the road. This saves hours, sometimes days of work.
- Apple’s docs are really good and pretty much all you really need for reference. Holding the option key and double-clicking on an object in xcode will take you straight its documentation.
- Though it seems not to say so anywhere on the apple website, the $99 developer program subscription lasts for 1 year.
- http://www.cocoadevcentral.com/d/learn_objectivec/ - this is a good intro to objective-C and C though most, if not all, of this stuff is covered in CS193P. Still, it’s nicely laid out and really easy to read. However, remember that this is not geared towards iPhone development. The main difference with objective-C on the iPhone is that the iPhone does not use garbage collecting.
- The developer.apple forums are great.
- http://groups.google.com/group/iphone-appdev-auditors - this is the auditors group for the CS193P class. You can ask any questions there.
- Me! Ask anything, I’ll try to help or at least point you in the right direction. Particularly, if you’re having a problem with any of the stanford assignments, I probably had the same problem already.