Mekwa from the web to the iphone - Presentation Transcript
mekwa
from the web to the iPhone
@bncoelho
wtf is mekwa?
• a social network
• designed to meet new people
• flirting and dating
• http://www.youtube.com/watch?v=5Fbiu0FUoSk
designed to meet new people
• http://www.youtube.com/watch?v=PpLOud6OplQ
can be used for flirting and dating
how does it work?
• create a mekwa
• tell it your wishes
• you set off fulfilling other peoples wishes
• you feel good and meet new people
fulfill wishes?
• choose a desire to fulfill (ex: sushi on the
beach)
• take a bunch of pictures and text
• create an entry
• the owner of the mekwa decides if the
wish was fulfilled
why the iPhone?
• mobile was an original goal for the mekwa
project
• it was a good tech showcase
• could play a bit further with localization
• we all had iPhones
goals on the iphone
• fulfill desires on the go
• check other mekwas around me
what we needed
• to know the current location
• to create an entry(pictures + text)
• search for new wishes
everybody is doing it
how hard can it be?
really hard...
at least for us...
our background
• web developers
• no mobile experience
• no objective-c or cocoa experience
• nda just had been lifted, barely no
documentation
• application was ambitious
• maps, camera, network, website integration
• and... we had a month and a half to do it
how we did it...
mekwa api
• rails is api friendly
• used xml as a hash bag
• geokit made location aware functionality
easy
what? no xml?
• no easy way to parse an xml document
• we’re used to see objects as bags of
properties
libxml2 + custom wrapper
• we used libxml2 to parse xml
• built a wrapper to build diccionaries from
api responses
uploading stuff
• really low level
• ended up building http requests by hand in
order to add image data to the requests
body
maps?
• there is no maps api in the sdk
• we thought about abandoning feature
open source
to the rescue...
• we found route-me project
• support for MS VirtualEarth and
OpenStreetMap
• caches tiles on sqlite
• supports the drawing of custom markers
user interface
• table views are very versatile
• gets you up and running very quickly
• however...
...they are a pain to
customize
• it’s not just drag’n’drop
• a designer can’t do it
• you have to code it
• we ended up pixel managing
• took a lot of work/time to
make them look nice
and was slow as a snail...
...but it was our fault
• cells are redrawn on demand
• images were being downloaded multiple
times
• scrolling was not smooth
• our answer was...
pre-load cache
• before loading each view we prefetched the
images needed.
• made loading a bit slower
• but scrolling was smooth
• at this point we didn’t have much time
• solution was a compromise
we had made it...
...barely
• at the end of our deadline we could:
• browse and accept entries
• search for wishes to fulfill
• create entries
• see other mekwas near us
it was an acceptable
prototype
...but still had its share
of problems...
• crashed on a semi-regular basis (and that’s
being gentle...)
• it was still slow...
...next steps
... improving for the AppStore
• the prototype was made in a collective
programming spree
• everything kinda worked but it was a
glorious mess
• the iphone has no garbage collector
• memory leaks are everywhere, releases
were missing
• iphone OS is merciless, it warns you the
first time and then it kicks you out
• crash!boom!bang!
memory leaks...
• objective-c memory model is based on a
reference counter
• alloc incs one
• release decs one
• on zero the object is deleted
• it’s pretty straight forward...
...as long as you know
who owns object
...it was two very frustrating weeks...
app was stable enough...
... except when taking pictures
UIImagePickerController
is a memory hog...
check out the memory spikes
6mb each
• every time a picture was snapped, the
memory usage had a 6mb spike
• adding that to the lack of releases, three
pictures and the app was kicked out
• so be careful how you use it
• our solution involved using a singleton
instance of the image picker controller
as data grew...
prefetching was revealing itself painfully slow...
• technical debt caught us pretty fast
• we were showing 10 entries, each could
have 4 pictures
• wait for 40 pictures to download
• 1 minute until the app is usable
• it made you think the app was dead
... use an activity indicator
...to show you app is not dead
how do you show an activity
indicator on the iphone?
hint: it’s not an animated gif...
...background threads
that’s how you do it...
• it had never occurred to us to use threads
on the iphone
• sending time consuming tasks to a
background thread keeps the UI responsive
• every desktop software developer knows
that...
... we had been stuck
in a webapp mindset for so long...
...we didn’t realize
the iphone was a different beast...
• we used background threads to load all
images as they were needed
• and after some synchronization issues
resolved
• we had just had turbocharged our app
and it felt good...
you can find it in the app store
...lessons learned
...almost all of them the hard way
• iphone apps are similar to desktop apps
• but with memory capabilities from 10 years
ago
• design is hard, not just drag and drop, you
have to code it
• threads speed up you app
• UIImagePickerController is a memory hog
• there was no maps api used route-me
• networking is really low level
• xml parsing is really low level
• http://www.youtube.com/watch?v=GjyKWiwTRxY
shameless plug
...so if you need an
iphone app
don’t hesitate, contact us at www.rupeal.com
0 comments
Post a comment