Manually Starting and Stopping the Reveal Server

We provide support that allows you to manually start and stop Reveal Server in your app. The instructions below assume that the appropriate RevealServer.framework has already been loaded into your iOS or tvOS app.

If you've linked RevealServer.xcframework into your app, the Reveal Service will start automatically when the UIApplicationDidFinishLaunching notification is posted during your app's launch.

Stopping the Reveal Service

If RevealServer.xcframework is loaded, the Reveal Server 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.

Starting the Reveal Server Manually

If you manually stop the Reveal Server, you can manually start it again 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).

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.