Link to home
Start Free TrialLog in
Avatar of Barry Jones
Barry JonesFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How to debug a javascript webapp on iPhone in Windows?

Hi.

I have been debugging mobile websites on Android using Eclipse and Android SDK tools - works great.

Now I have to try and debug the same app on an iPhone 3GS?  Is this possible?  How do I do it without a MAC? (I have Windows 7)

Thanks,

TheFoot
Avatar of mrcoffee365
mrcoffee365
Flag of United States of America image

The iPhone dev environments are set up so that they can only be run on a Mac, and it must be a Mac with an Intel chip, not the usual motorola chips.  They're not cheap, but you can find them used on eBay which helps with the cost.

Are you planning on using Objective C or actual Javascript?  If Javascript, we've had good luck with Phonegap.

See this discussion which includes British prices for used machines:
http://forums.macrumors.com/showthread.php?t=569696
Avatar of Barry Jones

ASKER

Thanks for your comment.  Sorry I was kisleading in my question - I'm actually creating mobile-friendly web applications. So.. html5/css3/javascript.  Not compiled apps..

Sorry for the confusion..

I heard something about installing the Apple iOS SDk on windows.. is that possible?  If so, would that allow me to debug a web browser process?

Thanks, TheFoot
It wasn't confusing -- I answered the question.  If you want to develop iPhone apps, you can only do so on a Mac with the Intel chip.  It has to be Leopard X or above as well.

It doesn't matter if your app is developed with Javascript, Objective C, or anything else you can think of.  The app itself has to be compiled on the Mac iOS where there is an Intel chip.

There is no SDK for Windows.
There is nothing to "compile".  I am not talking about native iphone apps.  Simply web "sites" running javascript.

So there is no way that you know of to debug javascript in a web browser process on an iPhone, while running windows?
It would probably be good for you to look at some of the Apple iPhone development apps.  

You can browse Web sites from an iPhone.  That is not an iPhone app -- it is the Web site page, formatted to look different on a mobile device.  The user gets there through Safari on the iPhone, for example.  See some documentation here about how to do that:
http://matt.might.net/articles/how-to-native-iphone-ipad-apps-in-javascript/
http://ofps.oreilly.com/titles/9780596805784/

If you are developing an iPhone app, and it is available through the iPhone store, there is a wrapper around every app, and it has to be compiled.

Check Apple's documentation about their development process here:
http://developer.apple.com/devcenter/ios/index.action
http://developer.apple.com/library/ios/navigation/#section=Resource%20Types&topic=Guides

You can certainly debug Javascript in lots of places.  Your question was debugging Javascript for an iPhone app, which means you need a development environment which will compile the resulting scripts into an app for you.  As I said, we used Phonegap, but there are others.  Be aware that depending on what you are doing, the Javascript that runs in whatever IDE you end up using for your iPhone app will be slightly different from browsers.   It's the same problem as developing Javascript for different browsers -- sometimes Javascript interpreters work differently in different browsers.  Same with iPhone IDEs.

And again -- see above answers -- no, there is no way to build an iPhone app on a Windows system.
Thanks for your response.

I understand the difference between a mobile web page and a mobile app - I build them for android for a job.

Forget the actual device for a second - "app" being short for "application" can also be a webpage that does something more than simply display static content.  I tried to make that clear in my second post - I did apologise for the confusion in terms.

Let me try and be as clear as I can - I am trying to debug a webpage application (NOT wrapped in PhoneGap or any other wrapper, NOT compiled into a hybrid or native mobile app) - simply an html5 webpage, running javascript that performs application tasks - not displaying static content. As in accessible via a public URL.

For clarity: http://en.wikipedia.org/wiki/Web_application

I get your answer - but I maintain that you have not actually understood, therefore answered my question.

Using Eclipse IDE, with the Android SDK and an Android device connected via USB in debugging mode, I can attach to the browser process and catch console.log() javascript output, which enables me to debug javascript in any "normal", non-compiled or wrapped webpage/webapp.

What I want to know is, can I do this for iPhone connected to a windows development machine?

I will wait to see if anyone else can answer this question, if not, then I will award you the points for your time.

TheFoot
Okay, if what you want is Javascript help, then you should probably delete this question and ask another one.

There's no reason that a Web page accessed from an iPhone would be different from any other access to a Web page.  iPhones use Safari, so you should do your testing with Safari.

As we know, javascript interpreters can be different in different browsers.  The Safari which runs on Windows is probably extremely similar to the Safari which runs on Macs -- but it cannot be absolutely identical.  Further, the Safari which runs on iPhones is often very slightly different from the one running on Safari on a Mac or Windows.

So of course you can use any means of debugging Javascript you want.  If you are concerned about specific behavior with the Safari running on an iPhone (and you'll have to pick the release of Safari you think is most likely for your user community) then you should have an iPhone to test with.

If your question was whether Web pages can be developed on Windows, then the answer is yes.
I am not after JavaScript help.  I need help debugging javascript running on an iPhone.  Hence why I posted this question in "iPhone" and "Misc Web Dev" groups.

The state of my app is different when running on an iPhone than when running on Safari.  I dont want to simulate the environment, I want to know if it is possible to debug the page running on an iPhone just as I do with Android.

...then you should have an iPhone to test with

I have an iPhone to test with - my question is how do I debug javascript running on it?

If your question was whether Web pages can be developed on Windows, then the answer is yes.

Er.. nope.  Please take more time to read through my posts - you'll see I've been quite clear about the fact that I want to DEBUG not DEVELOP.
Given your real question, I think it would make sense for you to delete this question and ask it again, perhaps with more detail.
How to debug a javascript webapp on iPhone in Windows?

Thats the title of the question.  It includes the words "debug", "iphone", "windows" and "javascript".

The only ambiguousness was with the term "webapp" which I clarified in my subsequent post.

More detail?  Are you kidding me?
Seriously -- you want to talk to different people.  Since this quesion already has a lot of answers, most experts won't look at it.  Click on the Request Attention link and ask that it be deleted.  Then ask a new question, and you'll get different people answering it.
This entire post has been polluted by me trying to get you to understand the question.  I've already requested attention.  I don't see any other way of wording the question in a way that accurately describes what I need to know.
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Brilliant - that's exactly what I need - the ability to see console.log() output.

As simple as that eh? :)

Thank you.