Debugging iPhone web pages in Objective-C

Encode QR in Objective-C Debugging iPhone web pages

Table 8.4
Printing QR Code ISO/IEC18004 In Objective-C
Using Barcode creation for iPhone Control to generate, create QR Code ISO/IEC18004 image in iPhone applications.
www.OnBarcode.com
DataMatrix Maker In Objective-C
Using Barcode generator for iPhone Control to generate, create Data Matrix ECC200 image in iPhone applications.
www.OnBarcode.com
Debugging iPhone web pages
Painting GS1-128 In Objective-C
Using Barcode creator for iPhone Control to generate, create GTIN - 128 image in iPhone applications.
www.OnBarcode.com
Draw Code 39 Extended In Objective-C
Using Barcode drawer for iPhone Control to generate, create Code 3 of 9 image in iPhone applications.
www.OnBarcode.com
Publicly available programs can make debugging on the iPhone easier. Location http://code.google.com/p/iphonedebug/ http://www.manifestinteractive.com/iphone/#_Webdev
Code128 Printer In Objective-C
Using Barcode creation for iPhone Control to generate, create Code 128 image in iPhone applications.
www.OnBarcode.com
Barcode Creator In Objective-C
Using Barcode generation for iPhone Control to generate, create Barcode image in iPhone applications.
www.OnBarcode.com
Program iPhone Debug iPhone Web Developer
Barcode Creation In Objective-C
Using Barcode drawer for iPhone Control to generate, create Barcode image in iPhone applications.
www.OnBarcode.com
EAN8 Generator In Objective-C
Using Barcode creator for iPhone Control to generate, create EAN8 image in iPhone applications.
www.OnBarcode.com
Using iPhone Debug
Quick Response Code Generator In None
Using Barcode generation for Online Control to generate, create QR Code image in Online applications.
www.OnBarcode.com
QR Code Creator In Objective-C
Using Barcode creator for iPad Control to generate, create QR Code 2d barcode image in iPad applications.
www.OnBarcode.com
Jon Brisbin s iPhone Debug is a JavaScript debugging program. He explained the need for the new tool by saying: The iPhone Debug Console is meant to give greater visibility and interactivity on your iPhone/iPod Touch while doing development. I grew frustrated having to go through the include console.log statement then reload method of debugging. I wanted something similar to Firebug s fantastic console and debugger. In trying to find something that would fit my needs, I came across Joe Hewitt s iPhone/Firebug integration, but I wanted something more robust and that worked without firebug and requiring console.log in the desktop browser. (http://code.google.com/p/iphonedebug/) The complete installation instructions are listed at the iPhone Debug website. They re complex enough that they re likely to change through additional revisions, so we haven t repeated them here. Generally, iPhone Debug provides you with similar functionality to the desktop Firebug, centering around a desktop console that you can use to receive data about a page you re viewing on your iPhone.
Printing UPC Code In None
Using Barcode generation for Online Control to generate, create UPC-A image in Online applications.
www.OnBarcode.com
UPC-A Supplement 2 Drawer In Java
Using Barcode encoder for Java Control to generate, create UPC A image in Java applications.
www.OnBarcode.com
Using bookmarklets
UCC - 12 Printer In VB.NET
Using Barcode generator for VS .NET Control to generate, create Universal Product Code version A image in VS .NET applications.
www.OnBarcode.com
Barcode Maker In None
Using Barcode printer for Software Control to generate, create Barcode image in Software applications.
www.OnBarcode.com
iPhone Debug is great for troubleshooting JavaScript code on your iPhone, but you may also want to debug plain HTML possibly when you don t have a desktop computer available. For this situation, there s one more tool that you might find useful: bookmarklets. The word bookmarklet comes from combining the words bookmark and applet. They re little bits of JavaScript code that are encoded as URLs. Thus, when you see a mini-application that you like, you save it as a bookmark, and then you can activate it at any time just by selecting the appropriate link from your bookmark list. For the iPhone, bookmarklets can give you all the client-side functionality that you want but don t have access to: things like viewing source, and using client-side tools like those found in Firefox and Safari. Listing 8.1 shows code that will view the source of a page, written by Erwin Harte based on original code by Abe Fettig.
Encode UPC Symbol In None
Using Barcode creation for Office Excel Control to generate, create UPC-A Supplement 2 image in Office Excel applications.
www.OnBarcode.com
Generate EAN / UCC - 13 In VB.NET
Using Barcode printer for .NET Control to generate, create EAN 13 image in VS .NET applications.
www.OnBarcode.com
Listing 8.1 The code for a show-source bookmarklet
Creating Barcode In VB.NET
Using Barcode generator for .NET Control to generate, create Barcode image in .NET applications.
www.OnBarcode.com
EAN13 Generator In .NET Framework
Using Barcode creator for ASP.NET Control to generate, create EAN13 image in ASP.NET applications.
www.OnBarcode.com
var sourceWindow = window.open("about:blank"); var newDoc = sourceWindow.document;
Generating Barcode In Java
Using Barcode creator for Android Control to generate, create Barcode image in Android applications.
www.OnBarcode.com
UPC A Generation In Java
Using Barcode encoder for BIRT Control to generate, create Universal Product Code version A image in BIRT reports applications.
www.OnBarcode.com
Profiling for the iPhone
newDoc.open(); newDoc.write("<html><head><title>Source of " + document.location.href + "</title><meta name=\"viewport\" id=\"viewport\" content=\"initial-scale=1.0;" + "user-scalable=0; maximum-scale=0.6667; width=480\"/><script>function do_onload()" + "{setTimeout(function(){window.scrollTo(0,1);},100);} if(navigator.userAgent.indexOf" + "(\"iPhone\")!=-1) window.onload=do_onload;</script></head><body></body></html>"); newDoc.close(); var pre = newDoc.body.appendChild(newDoc.createElement("pre")); pre.appendChild(newDoc.createTextNode( document.documentElement.innerHTML));
The code itself is basic JavaScript, and we won t go too far into the details. When clicked, this bookmarklet jumps to a brand new window that contains the entire text of the web page as a <pre> element. There s also a tiny bit of magic to scroll the chrome on an iPhone, solely for aesthetic purposes. In order to turn this code into a bookmarklet, you just need to urlencode() it so that the JavaScript is properly formatted as a URL. You can create whatever bookmarklets you want, to add functionality to your iPhone. But there s already a large collection of them available at the iPhone Web Developer site listed in table 8.4. To use that site, browse to it on your desktop Safari, adding the bookmarklets that you like to your bookmarks menu. Then you sync your Safari bookmarks to your iPhone through iTunes, and you ll have instant access to the Web Developer bookmarks that you wanted. Having now looked at several ways in which you can make your iPhone web pages work correctly, we re going to finish up with a look at how they can work better.
Profiling for the iPhone
Profiling or performance analysis is important for any type of computer program. But we ve gotten sloppy about profiling web pages in the last several years as bandwidth has gotten cheaper and more abundant. With the iPhone, we now need to sit up and start paying attention again. This is because of some of the unique features of the iPhone. We ve already touched several times upon the fact that an iPhone in the wild depends upon the EDGE or 3G network for downloading. This means that we have to create smaller, leaner pages. But we also always need to remember that one of the iPhone s unique features is its energy consciousness, and as a result we shouldn t be creating web pages that take more juice than they need. Solving the bandwidth problem is an easy one, because there are lots of tools available to help out, such as Safari s Network Timeline, which shows where your web page is getting slowed down. Generally, when analyzing bandwidth you should try to remember the low-bandwidth lessons of yesteryear, including the following:
Copyright © OnBarcode.com . All rights reserved.