« Integrating Reveal / Dynamic Loading

Starting and Stopping the Reveal Service

Loading the Reveal library dynamically means that you can control when the Reveal Service is started and stopped. The instructions below assume that libReveal.dylib or libReveal-tvOS.dylib has already been loaded into your iOS or tvOS app.

Starting the Reveal Service Manually

If libReveal.dylib or libReveal-tvOS.dylib is loaded, the Reveal Service will start automatically when the NSApplicationDidFinishLaunching notification is posted during your app's launch.

You can also choose to start the service manually by posting an NSNotification named IBARevealRequestStart:

Swift:

func startReveal() {
    NSNotificationCenter.defaultCenter().postNotificationName("IBARevealRequestStart", object: nil)
}

Objective-C:

- (void)startReveal
{
    [[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil];
}

You can post the same notification via LLDB if you'd prefer not to modify your app's code:

Swift:

expr NSNotificationCenter.defaultCenter().postNotificationName("IBARevealRequestStart", object: nil)

Objective-C:

expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil]

Once the notification has been posted if the server has started correctly, Xcode's console will output something similar to the following:

2015-01-20 16:07:59.474 Soundstagram[91612:9277015]  INFO: Reveal Server started (Protocol Version 17).

Stopping the Reveal Service

If libReveal.dylib or libReveal-tvOS.dylib is loaded, the Reveal Service can be stopped manually by posting an NSNotification named IBARevealRequestStop:

Swift:

func stopReveal() {
    NSNotificationCenter.defaultCenter().postNotificationName("IBARevealRequestStop", object: nil)
}

Objective-C:

- (void)stopReveal
{
    [[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStop" object:nil];
}

You can post the same notification via LLDB if you'd prefer not to modify your app's code:

Swift:

expr NSNotificationCenter.defaultCenter().postNotificationName("IBARevealRequestStop", object: nil)

Objective-C:

expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStop" object:nil]

Once the notification has been posted and the service has stopped, Xcode's console will output something similar to the following:

2015-01-20 16:07:59.474 Soundstagram[13320:11275032]  INFO: Reveal Server stopped.

Notes on Swift

When debugging Swift projects, LLDB expects any commands you pass to the expr command to be written in Swift, but only when the current call stack frame is within a Swift context i.e. if you have set a breakpoint in Swift code. In other cases, expr expects you to use Objective-C code.

If you're planning to use debugger commands to start and stop the Reveal Service in your Swift project, be sure to use the code snippet that corresponds to the language context of your breakpoint.

Getting Help

If you have any problems or questions about integrating Reveal into your app, head over to our support site.