Handling actions and eventsΒΆ

To get events and action callbacks, add the following functions to AppDelegate.m -

-(void)eventEnterCallback:(NSString *)name //contains the name of entered location
-(void)eventExitCallback:(NSString *)name //contains the name of exited location
-(void)eventDwellCallback:(NSString *)name //contains the name of dwelled location
-(void)eventCrossCallback:(NSString *)name - contains name of crossed tripwire location
/*************************
* Objective-C
*************************/
-(void)actionBasicCallback:(GeomobyActionBasic *)message //contains the action basic message. 

// Action basic callback
-(void)actionBasicCallback:(GeomobyActionBasic *)message
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle: [message getTitle]
                                                    message: [message getBody]
                                                   delegate: nil
                                          cancelButtonTitle: @"Ok"
                                          otherButtonTitles: nil, nil];
    [alert show];
}

/*************************
* Swift
*************************/
extension AppDelegate: GeomobyDelegate {
    
	func actionBasicCallback(_ message: GeomobyActionBasic!) {
		 print("event actionBasicCallback \(message.getTitle() ?? String.default) \(message.getBody() ?? String.default) \(message.getURL() ?? String.default)")
    }
}
/*************************
* Objective-C
*************************/
-(void)actionDataCallback:(GeomobyActionData *)data //contains the action data message

// Action data callback
-(void)actionDataCallback:(GeomobyActionData *)data
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle: [data getValue:@"Key1"]
                                                    message: [data getValue:@"Key2"]
                                                   delegate: nil
                                          cancelButtonTitle: @"Ok"
                                          otherButtonTitles: nil, nil];
    [alert show];
}


/*************************
* Swift
*************************/
extension AppDelegate: GeomobyDelegate {
    
func actionDataCallback(_ data: GeomobyActionData!) {

    if let key1 = data.getValue(.key1) {
      [...]
    }
  }

  [...]
  
}

Warning! If you want to work with the UI in these callbacks use dipatch_async():

dispatch_async(dispatch_get_main_queue(), ^{ /* do smth with UI */ });