Mobile: Initialize Appcues Mobile in your App (technical)

If you haven't already installed Appcues Mobile in your app, make sure to go here first.

Setup Appcues

Make sure to setup Appcues in your UIApplicationDelegate:

Swift
import Appcues

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
  	
  // Your app initialization code here
  Appcues.shared.setup()

  return true
}	
Objective C
@import Appcues;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  // Your app initialization code here
  [Appcues.shared setup];

  return YES;
}	

In cases of non standard window usage, for instance if your application uses multiple windows or does not initialize the keyWindow when the app launches, a keyWindow can be provided to Appcues via Appcues.shared.setup(keyWindow:)/Appcues.shared setupWithKeyWindow:];

Appcues Phone Editor

The button shown in this image is the Appcues Phone Editor. The editor enables you to send screens from the device to the web editor in order to add flows to that screen. After a flow has been added to the screen, that flow can also be previewed on the device using the editor.

Launch the Appcues Phone Editor

Use the code below to launch the Appcues Phone Editor. The editor is needed to build flows in conjunction with the Appcues Web Editor, but note that the code below should be removed from an app after the flows are built and the app is ready to deploy.
Swift
import Appcues

class ViewController: UIViewController {
      
  override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)

    Appcues.shared.launchEditor()
  }

}
Objective C

@import Appcues;
#import "ViewController.h"

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];
  
  [Appcues.shared launchEditor];
}

@end

Enable Appcues Logs

There are currently two log levels in the mobile sdk: none or debug (shows all error logs). The log level is per default none.

Swift

import Appcues

Appcues.shared.update(logLevel: .debug)

Objective C

@import Appcues;

[Appcues.shared updateWithLogLevel:AppcuesLogLevelDebug];

Next Step

Once Appcues Mobile is installed in your app and initialized, you need to Identify screens in your app

Still need help? Contact Us Contact Us