Developing with Astro
Astro Debugging Features
Debugging the worker and web content
app.js), by attaching the platform's browser to the webview you want to debug. On iOS use Safari, on Android use Google Chrome (note that these are the desktop browsers, not Mobile Safari or Mobile Chrome).
The Worker (aka
app.js. Many websites also name pages
index.html, so you may need to take a few tries when attaching to get the right
index.html. You will know you found the right one when the list of scripts includes
Safari Web Inspector Guide provides steps to attach desktop Safari to an iOS application's web views or worker.
Remote Debugging on Android with Chrome provides steps to attach desktop Google Chrome to an Android application's web views or worker.
Tips and Tricks
At times it is useful to use compiler flags to conditionally run some code in one build configuration, but not any other. Astro includes two compiler flags: DEBUG and RELEASE to allow only running code in a development (DEBUG) or release (RELEASE) build.
To add a compiler flag to an Xcode project:
- Open the Project view.
- Select the main app target (typically named the same as your project) and select Build Settings.
- Find the section "Swift Compiler - Custom Flags".
- Expand the "Other Swift Flags" entry and select the "Debug" row. Once its selected wait a second and then click in the right column to begin editing the flag. Type in the new flag value prefixed with "-D" (eg. "-D DEBUG") and hit
You can now write the following code to conditionally compile in DEBUG and RELEASE builds:
#if DEBUG println("We're in a debug build.") #elseif RELEASE println("We're in a release build.") #endif
Please Note: Use of conditional code should be kept to a minimum. It is really easy to write some code in one conditional but forget about the others and leave the code in a broken state.