Two (More) iPhone development tips (also involves ColdFusion Components)

Earlier in the week I helped a reader with a iPhone issue he was having. From this came two things I’d like to share with folks. Number one - don’t use Flash (sorry, couldn’t resist!). First - don’t forget that Safari on the iPhone has a development mode. This is critical for getting any type of feedback for JavaScript errors. How do you enable this? Go to your Settings, Safari page. At the very bottom is a Developer menu. Click it and you will see…

Obviously you want to ensure the Debug Console is turned on. Once done, if you return to the browser and rerun your page with the error, you will see a new notice:

Clicking that option will give you some details about the error:

It’s no Firebug, but it’s better than nothing.

So what’s the second tip? The error the user had involved a simple jQuery call to a CFC that returned JSON. It worked perfectly everywhere but the iPhone. Why? The iPhone didn’t like the fact that the result didn’t have the proper mime type. I asked him to add this line before his cfreturn: <cfcontent type=”application/json” reset=”true”>. Unfortunately this kinda breaks the reusability of the component. To be a bit more abstract, he could add a quick check for URL.returnFormat first and only use the content type when necessary.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for Extend by Auth0. He focuses on serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA