'Transfer object via WatchConnectivity from iOS to watchOS
I am trying to transfer EventKit Data like EKCalendars
/ EKEvents
/ EKReminder
from iOS to watchOS via WatchConnectivity
.
The connection works but I cannot push these objects directly in response. I also cannot use NSKeyedArchiver
since EKCalendars (example) are not able to get converted to Data.
So, any Idea how I can transfer simple EventKit Data from iOS to watchOS?
An additional hint: I am already fetching these data within watchOS (so no solution) but if the device has an MDM profile it cannot fetch anything but the holiday calendar so I just wanted to test if the iPhone can fetch more (since the MDM profile is stored on iPhone, not on watch) but I can't transfer these data trough WatchConnectivity.
Solution 1:[1]
You can serialize objects to String, transmit, and deserialize back to the object you need. Probably not the best way, but worked for me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | MykolaSharhan |