How big can the payload be when sending data via WatchConnectivity?
Asked Answered
R

1

18

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?

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.

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.

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.

Available in watchOS 2.0 and later.

Regal answered 8/10, 2015 at 21:4 Comment(0)
G
41

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

  • 65,536 bytes (65.5 KB) for a message
  • 65,536 bytes (65.5 KB) for a user info
  • 262,144 bytes (262.1 KB) for an application context

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.

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).

Gratia answered 29/1, 2016 at 4:7 Comment(4)
Thanks a lot! Yes, sending a dictionary that is larger than 65.5KB as complication data with transferCurrentComplicationUserInfo: on WCSession fails for me (never delivered, iOS 9.2.1, watchOS 2.1)Lucilla
@Lucilla So how do you send a large dictionary? #42784111Fabrice
@Gratia So how do you send a large dictionary? #42784111Fabrice
I've been playing around with this. I'm guessing Apple doesn't document what the limit is because they appear to compress the data.Rameau

© 2022 - 2024 — McMap. All rights reserved.