Evabalilk.com

The Perfect Tech Experience

Shopping Product Reviews

iPhone Development: RSS, XML, ASP.NET, and Generic Drivers

As soon as your boss gets an iPhone, he’ll ask you how to get to your corporate data from the road. The good news is that you’ll need a Mac and an iPhone, but then you have to make it all happen. We focused on delivering a solution quickly that was very simple, scalable, and quick to market.

Specifically for us, we have corporate statistics that our executives wanted to be able to easily view on the road without having to turn on a laptop, search for a wireless connection, log in to our web app, navigate to the statistics pageā€¦ you know the drill. . Instead, they should be able to pull out their iPhone and hit a ‘stats’ button. Boom! There are the statistics.

Many people are looking for the golden sample iPhone app that they can tweak and forget that a back-end infrastructure is required to feed that data to the requesting iPhone. To do that, you’re probably already thinking of a good web service that feeds back XML. SOAP comes to mind, but the current version of the iPhone SDK is light support. This is where most people will direct you to use REST. REST is great because it’s a URL-based requester, but it takes a lot of work to set it up.

Remember that part of our goal is “fast time to market”, so why not consider the generic HTTP handler found in Visual Studio?

This is what you do:

1. Follow the example to create an RSS reader and connect it to your iPhone. Follow it word for word and it will work just fine. Here is the link: http://theappleblog.com/2008/08/04/tutorial-build-a-simple-rss-reader-for-iphone
2. Now in visual studio add a public generic controller. This will be an .ASHX file
3. In your SQL database, create a table that holds a relationship between username and iPhone ID
4. edit the generic controller to support two parameters: one for the requested operation (in our case: stats) and one for the iPhone ID.
5. if they are validated, respond with the statistics in XML using context.response
6. Test it in your browser by passing the correct parameters so you know it works before you start trying to access from the iPhone.
7. Now adjust your iPhone app to use your new parameterized URL.

Once the basics work:

1. Create a corporate database table that holds the iPhone ID to User ID relationships and check it as the first operation in the controller. This makes the driver extremely secure because you can’t get past the front door without a valid iPhone ID. By the way, we use UDID to get the addresses to use. You have to do this for ad-hoc provisioning anyway so you’re doubly covered.
2. create a log function that writes the date, time, user, iPhone, and function to a table
3. improve iPhone app to allow drilldown capabilities (just another operation)

A couple of notes:

-this is scalable via the passed parameters.
-you can adjust the output to the asp.net level instead of the iPhone.
-This is very secure as only registered iPhones will get in.

LEAVE A RESPONSE

Your email address will not be published. Required fields are marked *