The laziest way to have Reveal available for all of your projects, without touching any source code
With the power of Xcode's symbolic User breakpoints, you can easily toggle on and off dynamically linking Reveal into your app.
The lazy way
Warning: This does not affect your current project or workspace breakpoints but will blast away any User breakpoints.
- Quit Xcode, and in terminal:
mkdir -p ~/Library/Developer/Xcode/UserData/xcdebugger && curl https://gist.githubusercontent.com/raven/8553761/raw/Breakpoints_v2.xcbkptlist -o ~/Library/Developer/Xcode/UserData/xcdebugger/Breakpoints_v2.xcbkptlist
Thats it, you're done.
Open any Xcode project and you will see in your breakpoint navigator a breakpoint that you can toggle on and off as you see fit.
Note: also make sure breakpoints are enabled for blue breakpoint goodness
What's happening here?
- Xcode's User breakpoints are kept in
~/Library/Developer/Xcode/UserData/xcdebugger, so the above script creates that directory if it does not exist.
- Then the script downloads the above xml file,
Breakpoints_v2.xcbkptlistand drops it in the xcdebugger directory (will overwrite any existing breakpoint file if one already existed).
- Breakpoint files in this directory are known as User breakpoints, and are available across all of your projects. The great thing is that they don't interfere with any project files, or source files.
- This xml describes a Symbolic breakpoint, that will issue a lldb command on every UIApplicationMain, and continue execution after running the command.
- The command that is issued is executes dlopen, and dynamically links the libReveal.dylib at runtime into your application. This command will need to be edited if Reveal.app does not live in your /Applications directory
- Once your run your app, the breakpoint gets fired once code enters UIApplication main, and libReveal is linked. Within libReveal, a
+loadmethod sets up the listeners to start the server once
UIApplicationDidBecomeActiveNotificationhas been fired to the notification center.
The long way a.k.a. I don't paste things from the Internet into my terminal
- Open the Breakpoint navigator in Xcode, and hit the '+' down the bottom and create new Symbolic Breakpoint
- Set the symbol to UIApplicationMain, add action and set to Debugger Command, add the command
expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2);, and tick Automatically continue after breaking
- Then right click the break point, and select Move Breakpoint To > User
- That's it. You should now see across all of your projects in the breakpoint navigator the User breakpoint
All of the above only works for Simulator Only, for ways to do this on device, read Oliver's post Integrating Reveal without modifying your Xcode project