Assigning an Interaction
The SDK automatically assigns an Interaction path to each View Controller. To override the Interaction path that is created automatically, call your View Controller and pass your desired Interaction path as a String
in the assignAutomaticInteraction
method.
In your viewDidLoad
or any other view lifecycle methods, which come before viewDidAppear
, simply set an Interaction path as shown below:
override func viewDidLoad() {
super.viewDidLoad()
if let interaction = try? MXOInteraction(withString: "/InteractionPath") {
do {
try MedalliaMXO.assign(automaticInteraction: MXOAutomaticInteractionAssignment { builder in
builder.interaction = interaction
builder.viewController = self
})
} catch {
print("Error assigning an interaction: \(error.localizedDescription)")
}
}
}
- (void)viewDidLoad {
[super viewDidLoad];
NSError *error;
MXOInteraction *interaction = [MXOInteraction initWithString:@"/InteractionPath" error:&error];
if (error) {
NSLog(@"Failed to create an interaction: %@", [error debugDescription]);
return;
}
__weak typeof(self) weakSelf = self;
[MedalliaMXO assignAutomaticInteraction:[MXOAutomaticInteractionAssignment initWithBuilder:^(MXOAutomaticInteractionAssignmentBuilder * _Nonnull builder) {
builder.interaction = interaction;
builder.viewController = weakSelf;
}] error:&error];
if (error) {
NSLog(@"Error assigning an interaction: %@", [error debugDescription]);
}
}
/
and only contains letters, numbers and/or dashes.