WCSession

If your watch app already has a WCSessionDelegate, then call the APLSessionDidReceiveMessage() method as follows to allow Appfigurate library to receive configuration data from the Appfigurate app on the paired iPhone.

Objective-C example

- (void) session: (WCSession*) session didReceiveMessage: (NSDictionary<NSString*,id>*) message
    replyHandler: (void (^)(NSDictionary<NSString*,id>*)) replyHandler {
    NSDictionary* reply = APLSessionDidReceiveMessage(message);
    if (reply != nil) {
        replyHandler(reply);
    } else {
        ...

Swift example

func session(_ session: WCSession, didReceiveMessage message: [String : Any], replyHandler: @escaping ([String : Any]) -> Void) {
    let reply = APLSessionDidReceiveMessage(message)
    if reply != nil {
        replyHandler(reply)
    } else {
        ...

If your watch app does not use WCSessionDelegate then a default implementation is provided.

Last updated