Posts tagged: iphone

Issues & Solutions for getting started in iPhone Projects

In the course of doing recipes for the Erica/Alexis project, I have learned that there are several things I need to be sure to do before modifying any of the base templates Apple provides.

1. Remember to add the app delegate string to main

When starting a new project, I am often faced with a black screen.  Despite the fact that this has happened to me three times now, it still takes me a bit of hair tearing before I remember it’s because I need to add the app delegate to the fourth parameter in the main method.

The solution to this, of course, would be to update my user templates so I don’t have to remember to do this every time.

2. Set the file’s owner to be the view controller

By default, the File Owner’s type is set to NSObject. When I have ViewControllers I want to use as a basis for my project, I need to change this so the File Owner’s type is set to my custom Root ViewController.

3. Remove the main xib line from info.plist

After changing (1) and (2), I was still getting this error: “2010-05-07 15:12:55.632 TwoItems[21829:207] Failed to load NSMainNibFile MainWindow.”

The problem was Read more »

Erica/Alexis Project: A Visual Update

The Erica/Alexis project is going quite well, despite my lack of new posts about it. I have a number of drafts in the queue, but for now, I give you visual evidence of the progress I’ve been making. Yes, I really love mini post-it notes:

OK, OK, I’ll RTFM!

Through the course of my progress through the iPhone Developer’s Cookbook, one thing is becoming increasingly clear to me: I did not understand fundamentals of Objective-C.

I really thought that my foundations in java, C#, and even C (thank you, Operating Systems with Jason Nieh) was enough.  I breezed through lists of the differences, read some code, and I was done, thankyouverymuch.  I even skimmed the “Objective-C bootcamp” section and deemed it irrelevant for me.

But with this challenge, I’ve promised myself to read every page of this book.  And you know what?  I really needed to RTFM.  Why?

  • I didn’t realize Objective-C is dynamically typed (even though I should have realized this with all the id variables floating around!)
  • I didn’t know selectors were basically just another way of saying “method name”
  • I didn’t know that if you do a child-to-parent assignment, like assigning an NSMutableArray to an NSArray, you’ll get the somewhat vague “assignment from distinct Objective-C” warning
  • I didn’t know you should always check for if (!self) in your init methods because in case of memory warnings, [super init] can return nil
  • I didn’t know that Apple has a standard on Class methods: any object returned by a class method is returned to you already autoreleased

It’s little things like these that can really trip me up.  So far, the Erica/Alexis project is incredibly rewarding.

Zombies, demystifying the XIB, and console clearing: iPhone Cookbook Lessons

I’m on page 58 of the second edition of Erica Sadun’s “iPhone Developer’s Cookbook,” and here are the most important lessons I’ve learned so far:

  1. Zombies!
  2. What’s inside that XIB?
  3. The Clear Log Button

Setting NSZombieEnabled to YESZombies!
Did you know that, by default, your XCode project is NOT enabled to catch Zombies?  And by zombies, I mean objects that you have released, but then subsequently try to access?  THEY ARE ZOMBIES! They are the dead that still roam.  This is good for horror films, but very bad for your code.  But, by default, XCode’s debugger has no way to catch these nasties.

If you try and access a destroyed or released object, you’ll get back a cryptic objc_msgSend.  But!  If you ENABLE THE ZOMBIES as Sadun suggests, you’ll get back a much better message. In my case, I’m trying to access an array (via this call: CFShow([array self])) that I’ve already released. This gives me the following message in my gdb console:

2010-03-30 21:39:28.180 HelloWorld2[2398:207] *** -[CFArray self]: message sent to deallocated instance 0x1810260

interfacebuilderGetting inside those .xib files
Read more »

iPhone Fluency in 163 Recipes

I recently picked up the Second Edition of Erica Sadun’s “The iPhone Developer’s Cookbook,” that focuses on the iPhone 3.0 SDK.

Now, admittedly, a third edition is now required given that the iPad comes along with SDK 3.2. However, I still feel that completing all 163 recipes outlined in Sadun’s book will bring me from iPhone development amateur to iPhone development expert–and give me a leg up in understanding the next version of the SDK.

So, my goal is to get through all 163 recipes over the remaining 347 days left this year.

Thanks to Julie & Julia for the inspiration on this one.

Learning to write iPhone Apps, and the intersection of Apple and LOLCATS

There are three main resources I’ve been using to teach myself Objective-C, Cocoa Touch and iPhone programming:

The cookbook is excellent as a reference, and as a human-readable, easy-analogy alternative to the lecture slides.
The class itself holds your hand with their assignments, and I have been slowly builing up my Obj-C development skills through their carefully thought-out assignments.

Finally, the ADC videos provide an excellent window into what iPhone OS 3.0 can do, and code samples to help you start actually doing it.

Now, you may be asking, “that’s all fine and good, but where do the LOLCATS come in?”

SO, you only need look at someone and you can quickly make an assessment if they’re an apple or a PC person.  Apple’s TV marketing depends on it.  But I would like to argue that you need only look at their EDUCATIONAL SLIDE MATERIAL to make the same assessment.

Sure, this isn’t from WWDC, but this is on iTunes to help people understand how to use iPhone OS 3.0.  If I wasn’t a Mac convert before, this truly would have made me a believer:
applelolcats.png

Brilliant.  Bloody fucking brilliant.

LouiseBrooks theme byThemocracy


Warning: require_once(/home/alexisgo/livetotry.com/talk/wp-content/themes/default/images/401.php) [function.require-once]: failed to open stream: No such file or directory in /home/alexisgo/livetotry.com/talk/wp-content/themes/louisebrooks/footer.php on line 22

Fatal error: require_once() [function.require]: Failed opening required '/home/alexisgo/livetotry.com/talk/wp-content/themes/default/images/401.php' (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/alexisgo/livetotry.com/talk/wp-content/themes/louisebrooks/footer.php on line 22