Titanium: Update an iPhone app with a remote JSON source
October 26, 2010Talking with a few leads today got me thinking about maintaining a group of iPhone apps for several clients, specifically the design and layout. Having to push out updates to the App Store just for a design change is so procedural. Good news is there is a way around it!
Here’s some code to demonstrate the technique (note: the Ajax class used here is just a wrapper for Titanium’s XHR method. It just makes it easier for me and the code a lot cleaner):
Remote JSON Source
Changing the search bar:
Easy right? You can even inject functions and call them from the app as well (Does this pose any security issues?):
Remote JSON Source
Source Code:
UPDATE: Since placing this post a few people have pointed out that the function in the JSON source above probably breaks Apple’s 2.8 guideline
A few people just referenced 2.7 and 2.8 of the Apple app store guidelines: https://developer.apple.com/appstore/resources/approval/guidelines.html
The function that’s in the JSON feed probably breaks 2.8 of the guidelines. I don’t think anything else in the JSON feed breaks their guidelines though considering 2.7 is extremely vague on purpose and would technically make any app that pulls in a JSON feed invalid.
Remember:
“They’re more like guidelines than actual rules” – Barbossa