views:

234

answers:

7

I'm interested in picking up some tips and tricks while learning about the SDK. What I am looking for something that you wish you had known getting started that would have benefited you now.

+1  A: 

In the case of a lot of developers, including Google, I'm sure they wish they knew their app would be rejected once complete.

Will Eddins
haha! How sad... and I was looking forward to having the official google voice app...
Strictly speaking, that involves the approval process, but not the iPhone SDK. Let's try to stick to helpful answers...
Quinn Taylor
In all seriousness, this is probably /the/ most important thing someone would have wanted to know before hand. I also think it's related to the SDK, since if your app is ultimately rejected, a legitimate question is whether or not you should have bothered learning the SDK in the first place.
johne
I don't deny the sincerity of the answer, or the importance of being aware of the risk. However, it's pretty highly publicized, and one would have to be pretty out of the loop to not have heard sob stories. FWIW, I still don't think it really applies — distribution isn't so much a programming problem, and there **are** people who do only ad-hoc or enterprise distribution. Look to the other answers to see great suggestions about what devs wish they had known about the SDK and iPhone best practices. That's the spirit of the question — for an iPhone novice, what are the pitfalls and hidden gems?
Quinn Taylor
+1  A: 
  • don't use a DOM parser, but a SAX parser. (Memory issues / speed).
  • if you use custom table cells, don't add too many views. (Slow scrolling issues)
  • if you add views to table cells, like labels, you may want to make their background opaque.
  • the generated table view code defeats the MVC paradigm. Think about your data model, and implement an UITableViewDataSource. Really.
Alfons
A: 

CoreData Bindings is not supported on the phone.

Chris McCall
Well they're not support on the Desktop either as there's no such thing. Do you mean Cocoa Bindings perhaps?
Mike Abdullah
A: 

Regarding the table view speed check out Loren Brichter's blog post http://blog.atebits.com/2008/12/fast-scrolling-in-tweetie-with-uitableview/

tapi
+1  A: 

One of the things I wish I knew at the very beginning was how to download data in a non-blocking way, specifically using NSURLConnection. The first versions of my apps suffered somewhat because I was using things like dataWithContentsOfURL:, which isn't a great idea on the iPhone, since you're never really sure what the network environment will be like for your users. To make it worse, I was testing over a fiber connection at home with an iPod touch, when a large number of my users were using Edge on their iPhones.

Cory Kilger
+1  A: 

Use the Clang Static Analyzer

http://clang-analyzer.llvm.org/

It's great for finding reference counting issues -- I have never seen a false positive.

Lou Franco
Can't wait for Xcode 3.2 in Snow Leopard to be in the hands of the general public. That alone _should_ eliminate lots of questions about leaks and over-releasing.
Quinn Taylor
+2  A: 

If you want to use SQLite, go with either Core Data (available in 3.0) or FMDatabase (Flying Meat). My first two apps, I wrote a customer wrapper and bound directly to SQLite. I am currently using FMDatabase with a new application and have found the experience much nicer.

Mark Suman