ios - WCSession - PayloadTooLarge

标签 ios watchkit apple-watch watchos-2

Apple 文档显示:

PayloadTooLarge - An error indicating that the item being sent exceeds the maximum size limit. This type of error can occur for both data dictionaries and files. Available in watchOS 2.0 and later.

有谁知道这两种方法将数据从 watch 传输到手机的最大大小限制是多少?:

func transferUserInfo(_ userInfo: [String : AnyObject]) -> WCSessionUserInfoTransfer

func transferFile(_ file: NSURL,
         metadata metadata: [String : AnyObject]?) -> WCSessionFileTransfer

我在任何地方都找不到它的记录。谢谢!

最佳答案

关于用户信息

transferUserInfo:

甚至还有并发症信息:

transferCurrentComplicationUserInfo:

大小限制 (iOS 9) 为 65.5 kB,与您可以使用的消息相同

sendMessage:

大小限制

updateApplicationContext:

262 kB

关于

transferFile:

ccjensen 的答案是正确的,因为我的经验是没有实际限制,甚至 Apple 文档在 WCSession 错误代码部分中提到该文件可能太大:

WCErrorCodePayloadTooLarge An error indicating that the item being sent exceeds the maximum size limit. This type of error can occur for both data dictionaries and files.

这部分文档不太清楚,所以在使用之前必须先检查一下。

关于ios - WCSession - PayloadTooLarge,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34683648/

相关文章:

ios - 如何使 UITableView 标题可选择?

ios - 在 Storyboard xcode 4 中添加的 View Controller 的 .h 和 .m 文件

ios - WatchOS3中SKShapeNode添加手势

ios - 在真正的 Apple Watch 上调试 WatchKit - 没有任何反应

ios - 使用动画更改 CAShapeLayer 的位置

iPhone - 触发 APNS

ios - 从通知中心打开推送时 Apple Watch : dynamic Long Look not shown,

ios - 核心数据 - 禁用从缓存加载

ios - Apple Watch、几个目标和共享的 Watchkit 扩展/Watckit 应用程序目标