Use Safari to remotely debug an iOS device webpage

Source: Internet
Author: User
Tags home screen

Recently in the HTML 5 game, published to the phone to visit the webpage is always puzzling problem, suffer from no remote debug function has not been found to find the problem.

This blog details the debugging methods for iOS, Android, and Windows phone:

http://developer.telerik.com/featured/a-concise-guide-to-remote-debugging-on-ios-android-and-windows-phone/

1. How to use

Connect to iphone under Mac It's really good to try.

Environment:

Mac OS 10.9 Mavericks, IOS 8.1

Steps:

1. On iphone, set-"safari-" Advanced-"open web Detector"

2. On Mac, Safari Preferences-"advanced-" Displays the development menu in the menu bar

3. Connect your phone, open a webpage on your phone safari, and add it to your home screen (you can't remotely debug a Web page that Sarafi directly, you can only test add to the home screen), and open the page from the shortcut icon on the home screen

4. On Mac on Safari's development menu bar, drop-down can see connected devices, hover to see Open Web page, click to open website Inspector

2. Memo

The Web Checker function is similar to the Firefox debugging function, you can set breakpoints, view variables, but did not find the watch variable function.

The log view of the console is also inconvenient, in order to check the log, I rewrite the log function, tied to the console, the log push to an array, so that the Web inspector can be found soon so log The release project uses UGLIFYJS's drop_console to directly remove all log calls.

Rewrite the Window.onerror method, can be more convenient to crawl the error, as long as the rewrite function to make a breakpoint, error will come in, you can see the stack of error messages.

function (ErrorMessage, Scripturi, linenumber, ColumnNumber, error) {  //  your handler}

For loading the game error can be set breakpoints, and then refresh in the Web Inspector Point, if the iOS device directly by pressing the home button will directly end the Web inspector, unable to find.

Use Safari to remotely debug an iOS device webpage

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.