iPhone应用程序未加载时Watchkit通信错误

时间:2016-12-13 20:25:22

标签: ios watchkit

尝试从我应用的观看扩展程序代理向随播iPhone应用程序发送消息时,会引发错误(WCErrorCodeDeliveryFailed)。

情况是:

  • 使用模拟器或设备(iOS 10.1 WatchOS 2)

  • iPhone应用程序未加载到内存中(既不是前景也不是背景)

  • 在Watch扩展委托awakeWithContext方法中,会话已激活
  • 在Watch扩展委托willActivate方法中,将消息发送到iPhone应用

if ([self.watchSession isReachable]){ NSDictionary *applicationDict = @{@"request":@"Status"}; [self.watchSession sendMessage:applicationDict replyHandler:nil errorHandler:nil]; }

这会显示错误消息:[WCSession _onqueue_notifyOfMessageError:withErrorHandler:] errorHandler: NO with WCErrorCodeDeliveryFailed

因此,此消息在后台发送iPhone应用程序......

任何想法?感谢

0 个答案:

没有答案