问题
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