userInfoTransfer, payload is too big

时光怂恿深爱的人放手 提交于 2019-12-12 02:34:01

问题


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

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