WCSession sendMessage:replyHandler错误代码7014(WCErrorCodeDeliveryFailed) [英] WCSession sendMessage:replyHandler error code 7014 (WCErrorCodeDeliveryFailed)

查看:946
本文介绍了WCSession sendMessage:replyHandler错误代码7014(WCErrorCodeDeliveryFailed)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Watch OS 2应用程序,通过 WCSession 方法与iOS应用程序进行通信 sendMessage:replyHandler:errorHandler:

I have a Watch OS 2 application that communicates with the iOS app via WCSession method sendMessage:replyHandler:errorHandler:

iOS应用程序正确回复,但我不时收到错误代码 7014 of domain WCErrorDomain :无法交付有效负载

The iOS application reply correctly but time to time I get the error with code 7014 of domain WCErrorDomain: "Payload could not be delivered"

当iOS应用程序不是前台时,它会更频繁地发生。

It happens more often when the iOS application is not foreground.

我没有找到任何解决这个问题的方法,我希望你们中的一个知道解决这个问题的方法

I do not find any solution of this problem, I hope one of you know a solution to this problem

推荐答案

对于在iOS10 beta 6和GM上遇到问题并且您使用的是Swift3,解决方案是将iOS应用中的委托功能标题更改为以下内容:

For anyone having issues on iOS10 beta 6 and GM, and you are using Swift3, the solution is to change the delegate function header in the iOS app to the following:

    func session(_ session: WCSession, didReceiveMessage message: [String : Any], replyHandler: @escaping ([String : Any]) -> Void) {

注意@escaping和Any而不是Any对象类型。

Note the @escaping and the Any instead of the AnyObject type.

这篇关于WCSession sendMessage:replyHandler错误代码7014(WCErrorCodeDeliveryFailed)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆