events matching different on iPhone and watch

Hi,


I'm struggling with an odd problem. I have an app that searches the user's calendars for current events. The code works correctly on an iPhone, and in the Watch simulator but not on a real watch. I've narrowed it down to the observation that for some reason the calendars that the app has access to are different on the watch and on the phone. Both the watch and the phone are signed into the same iCloud account and I can confirm that the actual calendar app on the watch can see all of the calendars. This snippet simply prints out the calendars that the code has access to: (Note that this is after I have successfully requested and received access from the user)


let cals = store.calendars(for: EKEntityType.event)

NSLog("We can access \(cals.count) calendars")

for cal in cals {

NSLog(" \(cal.title)")

}


When this is run on the phone:

fastdial[1766:775660] We can access 22 calendars

(followed by the list of 22 calendars)


When this is run on the watch:

2017-04-10 10:18:30.726047-0700 FastDialWatch Extension[268:313870] We can access 2 calendars

2017-04-10 10:18:30.738466-0700 FastDialWatch Extension[268:313870] US Holidays

2017-04-10 10:18:30.739022-0700 FastDialWatch Extension[268:313870] Birthdays


Again, to be clear the calendar on the watch can see all of the calendars and so can the complication. The code in question is in the same file and in the same project.

iOS 10.3.1 on an iPhone SE

watchOS 3.2 on a Series 2

Xcode 8.3.1


Any ideas how I can go about debugging this?


Thanks.

The watch just hasn't updated all the events. Also, make sure Apple Watch is on the latest firmware (watchOS 3)

The calendar app on the watch can see all calendars and all events. This tells me that the watch has synced just fine. Both iPhone and watch are on the latest firmware 3.2 and 10.3.1 respectively.

So, this seems to be my issue : https://forums.developer.apple.com/message/51233#51233


If I remove the corporate MDM profile from my phone then I can see all of my iCloud and Google calendars. If I add it back then they disappear again and I can only see the US Holidays and Birthdays calendars.

The logic in the answer to the issue above is that the restriction "Don't allow unmanged apps to open managed data" prevents a 3rd party app from accessing the Exchange calendar. This makes sens to me. I don't understand, though, why it prevents my app from opening my own iCloud calendar.

I have filed bug # 31636993 with Apple

events matching different on iPhone and watch
 
 
Q