通过WatchConnectivity发送数据时,有效载荷有多大?

问题描述:

使用WatchConnectivity框架发送数据时(从手机到手表,反之亦然),在该框架给我WCErrorCodePayloadTooLarge错误之前,有效载荷有多大?

When sending data using the WatchConnectivity framework, either from the phone to the watch or vice-versa, how big can the payload be before the framework gives me the WCErrorCodePayloadTooLarge error?

我在Apple的文档中找不到答案,并且目前互联网上似乎没有太多的信息(实际上,谷歌搜索WCErrorCodePayloadTooLarge仅给出4个结果).

I couldn't find the answer on Apple's documentation, and there doesn't seem to be much information on this on the internet at this time (in fact, googling WCErrorCodePayloadTooLarge gives me just 4 results).

有人测试过以找到答案吗?如果这个问题没有答案,我将尝试自己解决并发布结果.

Has anyone tested to try to find the answer to this? If this question doesn't get an answer, I will try to do it myself and post the results.

到目前为止,我所拥有的所有信息就是它可能能够支持大于30 MB的文件.我之所以这样认为,是因为我在iPhone上拍摄了很多原始照片,它们通常约为36MB,并且总是显示在手表的照片"应用中.

So far, all the information I have is that it may be able to support files that are bigger than 30 MBs. I think this because I take a lot of raw photos on my iPhone, and they usually are ~36MB in size, and they always show up in my watch's Photos app.

作为参考, WCSession 的文档中对WCErrorCodePayloadTooLarge的描述如下:

For reference, WCSession's documentation has the following description of 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.

在watchOS 2.0和更高版本中可用.

Available in watchOS 2.0 and later.

根据私有符号WCPayloadSizeLimitApplicationContextWCPayloadSizeLimitMessageWCPayloadSizeLimitUserInfo,限制(自iOS 9.0.2起)为:

According to the private symbols WCPayloadSizeLimitApplicationContext, WCPayloadSizeLimitMessage, WCPayloadSizeLimitUserInfo, the limits (as of iOS 9.0.2) are:

  • 一条消息的65,536字节(65.5 KB)
  • 用户信息
  • 65,536字节(65.5 KB)
  • 用于应用程序上下文的262,144字节(262.1 KB)

我不知道苹果为什么不记录这个事实,除了事实是,通过WatchConnectivity发送字典来确定它们到底有多大可能很困难.当然,可接受的大小可能会随着时间而改变.

I don't know why Apple wouldn't document this, other than the fact that it can be difficult when sending dictionaries through WatchConnectivity to determine exactly how large they are. Certainly the acceptable sizes may change over time.

尽管我注意到在发送大文件(数百MB)时似乎变得不可靠,但是我在发送文件时找不到(也没有亲自观察)任何最大大小限制.

I couldn't find (and haven't personally observed) any maximum size limit when sending files, though I've noticed that it seems to get unreliable when you send large files (hundreds of MBs).