WCSession - PayloadTooLarge

 ̄綄美尐妖づ 提交于 2019-12-23 03:06:29

问题


Apple Documentation shows:

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.

Does anyone know what the max size limits are for both these methods are for transferring data from the watch to the phone?:

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

and

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

I can't find it documented anywhere. Thanks!


回答1:


Regarding userInfo

transferUserInfo:

and even for complication info:

transferCurrentComplicationUserInfo:

the size limit (iOS 9) is 65.5 kB, the same for messages you can use with

sendMessage:

The size limit for

updateApplicationContext:

is 262 kB.

Regarding

transferFile:

ccjensen's answer is correct as my experience there is no actual limit even the Apple doc mentioned in the WCSession error code section that the file could be too big:

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.

This part of the documentation is not really clear so you have to check it always before using it.




回答2:


Not sure about user info, but I haven't hit any limits yet on file size (as long as the watch has enough free space).



来源:https://stackoverflow.com/questions/34683648/wcsession-payloadtoolarge

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!