I have been developing an app the works with the apple watch's workouts and an iPhone. The app is written in swift and communication has been working properly for weeks while I add features. I am suddenly getting the following error code when I try to run my app on my iPhone.
[WCFileStorage loadAppContextDataFromInbox] error loading in application context from inbox NSFileReadNoPermissionError -> EACCES
This error is being generated on a program that was working fine using the same code. I believe the error is coming from the following line of code:
WCSession.default.updateApplicationContext(dictionary)
in the func shown below.
func sendAppStateToWatch(appState : String?) {
if WCSession.isSupported() {
if let appStatus = appState {
do {
let dictionary = ["iOSAppState" : appStatus]
try WCSession.default.updateApplicationContext(dictionary)
} catch {
print("sendActiveTimeToPhone() ERROR: \(error)")
}
}
}
}
This function has been working without problem for at least a month. Suddenly, I am getting the error shown above. I have rebooted the watch, phone and Xcode without effect. I suspect the error comes from some privacy setting on the phone or watch that flipped, but looking around I cannot find the problem. Any help is appreciated.