Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 09-04-2008, 03:38 AM   #2 (permalink)
David H Dennis
New Member
 
Join Date: May 2008
Posts: 49
David H Dennis is an unknown quantity at this point
Default

If you are loading 4.5mb of stuff into your application, it will crash, because iPhone applications can only use about 2mb of heap space before getting out of memory errors. These problems don't show up in the simulator because it has all your computer's memory at its disposal.

A sqlite3 database will probably work because you have a relatively simple application, but it will chew up a lot of memory and not give it back unless you're very careful. For each query you use, create a query handle (sqlite3_stmt) with the prepare API function, and save it into a global variable. Then reset that query when you are done, and re-run step when you want to run it again. This works but still seems to use up much more memory than is seemly. Creating ad hoc queries using sprintf() guarantees that your application will run out of memory and crash.

My iTrivia application (which you can buy from the app store starting today- hurrah!) works that way.

For a dictionary, I might recommend a simpler solution, as long as the number of words is not that high. Load the words and a record ID number into an array of objects. Then make the definitions files in your app bundle that are named after the ID number. For instance, record ID 10 would be 10.html .

This will give you blazing fast searches, since the words are in memory, and quick loads of the definitions into the web view because web views are designed to be used that way.

While developing my HauntFinder application (not yet submitted), I discovered that in a situation like this incremental search works great - that is, instead of waiting for someone to press the search button, take each character and have it search right away. So you type "d" and you get "dog", "domestic" and "diddle"; then type "o" and get "dog" and "domestic" and "m" and get only "domestic". It's actually quite surprising how few characters you need to zero in on the word you want.

This probably seems like a slightly bizarre way to work, since if you're like me you're spoiled by easy access to SQL data from other programming environments, but I can tell you that it will work, and look great to your end user.

Good luck with your application!

Hope that helps.

D
David H Dennis is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,471
Threads: 94,038
Posts: 402,622
Top Poster: BrianSlick (7,978)
Welcome to our newest member, jimmychoow
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:08 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.