iPhone on holidays

Welcome back everybody!
I just want to share with you my little experience I had with the iPhone sdk during my summer holidays.

This year I haven’t spent my holidays on the beach, like usual, because I just bought home and so I had to put up everything… that’s why I decided to devote some of the free time to try out objective-c. I wanted to make something for the iphone since I bought it in March in NYC but I never had the free time to do that..

First of all I had to buy a new Mac-mini because the iphone sdk is not supported on my old mac-mini ppc. Then I had to subscribe to the developer program for $99 because otherwise I was unable to test applications on my iphone, but only on the simulator (cool, I have to pay to install my own applications on my iphone!).

Well, after reading a bit the documentation, watching some video tutorials and looking at example code I started with my first application. What I wanted to do was a simple SMS application to show sms received, sent and a simple search. A very simple app but for me better than the limited built-in iphone sms application.

After a couple of days I reached my goal, but not without troubles. There’s nothing inside the iphone documentation about the SMS system.

Afterward using an “UPDATE” sqlite query I was getting an error: “SQL error: no such function: read”, and obviously there was nothing in the doc explaining this. Only after half a day I discovered that I had to create a C method and use sqlite_create_function in order to bypass that error:
const char *fn_name = "read"; sqlite3_create_function(database, fn_name, 1, SQLITE_INTEGER, nil, sqlite_fn_read, nil, nil);
Now that everything with the db was fine I had to google a bit in order to find a way to implements features like “reply”, “forward” or “call” (basic features in a telephone, but not covered in the iphone sdk documentation).

Finally, after a long debug and Instruments session to find leaks ( I must admit xcode has some powerful tools for debugging and inpect apps) I installed my first application on my own iphone.

And big big surprise!! On the iphone my application is unable to mark messages as read and delete messages too!
In other words it is unable to write into the sms.db!

And Why?
That’s because a beautiful sandbox which does not allow applications to write outside their scope! Oh, cool! That’s correct, but in this case you, Apple, must give me an API which wraps those features!
They gave an SDK for developing on a mobile phone but they don’t grant access to any of the telephone features?!?

Share with...