So you are trying to send instant message to parent iPhone app and still receiving “Payload could not be delivered”? This happens only if one of those two thing occured:
1. there is no connection to watch (you should check session.reachable in WCSession)
2. your iPhone app is not responding with didReceiveMessage:replyHandler:
Second one is the most probably so how to fix it? There are 2 “didReceiveMessage” methods in WCSessionDelegate protocol, to make it work, you need to implement second one:
- (void)session:(WCSession *)session didReceiveMessage:(NSDictionary*)message replyHandler:(void(^)(NSDictionary *replyMessage))replyHandler;
so just make it look like:
- (void)session:(WCSession *)session didReceiveMessage:(NSDictionary*)message replyHandler:(void(^)(NSDictionary *replyMessage))replyHandler { NSLog(@"iPhone: didReceiveMessage %@", message); replyHandler(@{@"command": @"reply"}); }
You just need to respond with NSDictionary. And it works. Really.