问题
I'm trying to send a fair bit of data from a watchOS app, to the iOS app. The data is comprised of generated content on the watch. This data is stored in Core Data on the watch. So I'm not actually transferring a file, in which case I'd use transferFile
. I've attempted to use transferFile
in this case, but a file URL is required. Since I'm not actually transferring a file, I'm not sure what to do.
According to this: WCSession - PayloadTooLarge
I'm currently limited to 65.5kb. My average transfer requirements are from 0 - in the megabytes. Most are probably between 0 - 400kb.
How can I transfer this data?
I guess I could break it up? However that would be a bit hackish, as I'd also need code in the iOS app to piece it back together before use.
This is my call to transferUserInfo
:
func sendDictionary(dict: [String: Any]) {
WCSession.default().transferUserInfo(dict)
}
dict
is a dictionary object from a Core Data query.
Thanks.
回答1:
Have you tried saving the dictionary as JSON on disc, then sending that as Data with transferfile() and cleaning up the file afterwards?
来源:https://stackoverflow.com/questions/42783611/userinfotransfer-payload-is-too-big