Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript in iPhone programming

I am currently developing apps for the iPhone and iPad with Objective-C. I found some code related to using JavaScript in the iPhone.

  1. Can we create apps more easily and accurately with the help of JavaScript?
  2. Does Apple approve apps created at least partially with JavaScript?
  3. How should one begin learning JavaScript?
  4. Are there any tutorials that can help me to understand and learn JavaScript, particularly for iPhone/iPad programming?
like image 246
PJR Avatar asked Aug 17 '11 05:08

PJR


2 Answers

Web Apps

Web Apps are highly optimized special websites that are accessed from any device but still look and feel like a full-fledged application. An early example would be GMail. Here is an old blog post by jQuery's John Resig on early web app development.

1. Can we create apps more easily and accurately with the help of Javascript?

This is a bit mis-leading as the intents may be different. The goal of web apps to hit the widest possible audience with minimal effort, however, you are restricted to non-native functions.

Native functions include use of the device hardware such as camera, gps, touching other apps, notifications etc. There are several libraries that provide a wrapper around your web app to expose these underlying calls but then you must do that for each device. Libraries include: Phonegap, Titanium.

2. Does Apple approve apps created at least partially with JavaScript?

Most certainly! They even have a special section. With most webapps it is just a bookmarklet the user drags to their home screen for quick access. If you want to do the true app in the store you will need a wrapper library as mentioned before to package your app together.

3. How should one begin learning JavaScript?

Out of scope for this question, but Douglas Crockford is one of the better teachers, he has a multi-part video series as well as a book to get you learning the "good parts".

4. Are there any tutorials that can help me to understand and learn JavaScript, particularly for iPhone/iPad programming?

Honestly, it would best to learn javascript first, as it is a prototypical object based puzzle then worry about how to utilize the various frameworks for best mobile performance.

Adding 5. What are some javascript mobile frameworks?

  • jQuery Mobile
  • Dojo Mobile
  • Sencha (Ext) Touch
  • Wink
  • iUI

These are just the most common but I would browse each of them a bit as jQuery, dojo and sencha have different approaches on how javascript should be used.

like image 137
WSkid Avatar answered Nov 19 '22 15:11

WSkid


  1. Can we create apps more easily and accurately with the help of JavaScript?. Yes and No. Javascript will allow you to write loose code and draw from a wealth of code floating around, it is less technical than writing in Objective C, however the UI will be less responsive than native and quite a bit more buggy. My advice is if you your not proficient in Javascript then "don't go there".

  2. Does Apple approve apps created at least partially with JavaScript? Apple will frown upon this and you may find that if the App is entirely within the UIWebView you may be rejected, but I have not experienced this (they do sort of state this in their guide).

  3. How should one begin learning JavaScript? Read material from Douglas Crockford first, I really don't agree with half the stuff he says, but to a complete beginner then he will enlighten you. Also start playing with jQuery. Manipulating HTML is painful and this will save you a lot of pain.

  4. Are there any tutorials that can help me to understand and learn JavaScript, particularly for iPhone/iPad programming? You will be essentially be writing for a Safari browser (webkit). Your standard jQuery will get you along the way, but one very important piece of advice - Objective C isn't simple but that doesn't mean that Javascript is. designing UI interfaces for a mobile device will definitely cause you headaches - be under no illusions, even with mobile frameworks/libraries like JQTouch, Sencha and jQueryMobile you will feel the pain!

Good Luck :)

like image 3
martin Avatar answered Nov 19 '22 15:11

martin