
#Iconsole app how to#
delegate = myDelegate įor an example of how to implement this, look at the HelloWorld app.
#Iconsole app code#
Note that this code must be called BEFORE the console is first shown, or the input field will not appear. iConsole does not place any restriction on the command syntax, or provide any helper methods for processing commands at this time.ģ) Use the following code to set your class as the delegate for the iConsole. This receives a single string representing the command that the user has typed. your app delegate or main view controller.Ģ) Add the handleConsoleCommand: method to your delegate class. It doesn't matter which one, but it should be a persistent class that will exist for the duration of the app's lifetime, e.g. To enable it, you need to create a command delegate, which you do as follows:ġ) Implement the iConsoleDelegate protocol on one of your classes. The console has a button for clearing the log, but if you ever need to clear it programmatically then you can do so using the clear command: Īs well as displaying logs, the console can also allow user command input. The console is shown/hidden using a screen swipe by default, but if that is not appropriate for your app, you can show and hide it programmatically using: use for logging conditions that lead to a crash In addition to the log: method, there are also the following additional log functions that can be use in conjunction with the LOG_LEVEL constant to easily control the amount of logging in a given app build: // use for informational logs (e.g. The iConsole logging commands are also thread safe and so can be used anywhere in place of NSLog(). The message can have format parameters, and follows the same syntax as the NSLog() command, and will log to both the in app and Xcode console. pch file to make it available throughout your project), and then add logging code of the form: To log to the console from within your app, include the iConsole.h header in your class (or in your. If you are already using a custom window subclass, change the base class to iConsoleWindow. If you are using a standard project template, the easiest way to do this is to change the class of your window in the MainWindow.xib file, or the AppDelegate.m if your window is created programmatically. To enable iConsole in your application, replace your main window with an instance of the iConsoleWindow.
#Iconsole app update#
If you need to update the GTM classes, you can check out the latest version using: svn checkout google-toolbox-for-mac-read-only
#Iconsole app install#
To install iConsole into your app, drag the iConsole and (optionally) GTM folder into your project. tool in Xcode and make sure all files that you wish to use ARC for (including iConsole.m) are checked. If you wish to convert your whole project to ARC, comment out the #error line in iConsole.m, then run the Edit > Refactor > Convert to Objective-C ARC. To do this, go to the Build Phases tab in your target settings, open the Compile Sources group, double-click iConsole.m in the list and type -fobjc-arc into the popover. If you wish to use iConsole in a non-ARC project, just add the -fobjc-arc compiler flag to the iConsole.m class file. ARC CompatibilityĪs of version 1.5, iConsole requires ARC. it doesn't rely on any unavailable SDK features) but is no longer being tested for compatibility and may require tweaking or bug fixes to run correctly. 'Compatible' means that the library should work on this OS version (i.e. NOTE: 'Supported' means that the library has been tested with this version.

It also allows non-technical beta testers of your applications to submit log information to you easily. It enables you to check error and crash logs within a built application without needing to connect to the Xcode debugger. IConsole is a simple, pluggable class to enable more useful in-app logging for your iPhone apps.
