Passing data to Apple Watch app

后端 未结 5 922
天涯浪人
天涯浪人 2020-11-29 03:34

I am trying to pass data from my app into my Apple Watch app. Basically, I am using the same method as I used for creating the today widget and so I am passing data through

5条回答
  •  南笙
    南笙 (楼主)
    2020-11-29 04:08

    Another way to communicate between the app and the watch is via wormhole:

    https://github.com/mutualmobile/MMWormhole

    Send:

    [self.wormhole passMessageObject:@{@"titleString" : title} 
                      identifier:@"messageIdentifier"];
    
    id messageObject = [self.wormhole messageWithIdentifier:@"messageIdentifier"];
    

    Recieve:

    [self.wormhole listenForMessageWithIdentifier:@"messageIdentifier" 
    listener:^(id messageObject) {
    // Do Something
    }];
    

提交回复
热议问题