sabre-io / dav

sabre/dav is a CalDAV, CardDAV and WebDAV framework for PHP
http://sabre.io
BSD 3-Clause "New" or "Revised" License
1.51k stars 344 forks source link

Newly created Calendars not synced with Apple iCal #493

Closed c0d3z3r0 closed 10 years ago

c0d3z3r0 commented 10 years ago

A manually created calendar in the mysql database will not show up in Apple iCal (Mavericks). Also a Calendar created in iCal does not get synced to the database. The Mac OS log doesn't show any errors even with debug mode enabled.

sabre/dav 2.0.3 Mac OS 10.9.4

evert commented 10 years ago

Can you share the sql query used to create the calendar?

c0d3z3r0 commented 10 years ago

I duplicated one calendar I imported some time ago with the migration script using phpmyadmin. I only changed the uid and name:

INSERT INTO `calendars` (`id`, `principaluri`, `displayname`, `uri`, `description`, `calendarorder`, `calendarcolor`, `timezone`, `components`, `transparent`, `synctoken`) VALUES
(11, 'principals/testuser', 'test', '2C92F720-DB2E-4938-8F22-89118FA50CD0', NULL, 1073741962, '#F64F00FF', 'BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Apple Inc.//Mac OS X 10.9.4//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VTIMEZONE\r\nTZID:Europe/Berlin\r\nBEGIN:DAYLIGHT\r\nTZOFFSETFROM:+0100\r\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU\r\nDTSTART:19810329T020000\r\nTZNAME:MESZ\r\nTZOFFSETTO:+0200\r\nEND:DAYLIGHT\r\nBEGIN:STANDARD\r\nTZOFFSETFROM:+0200\r\nRRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU\r\nDTSTART:19961027T030000\r\nTZNAME:MEZ\r\nTZOFFSETTO:+0100\r\nEND:STANDARD\r\nEND:VTIMEZONE\r\nEND:VCALENDAR\r\n', 'VTODO', 0, 13),
evert commented 10 years ago

This calendar only supports VTODO components. It wouldn't show up for that reason in iCal.

It should show up in the Reminders app though, if syncing is enabled for that.

c0d3z3r0 commented 10 years ago

Sorry.. was the wrong calendar..

INSERT INTO `calendars` (`id`, `principaluri`, `displayname`, `uri`, `description`, `calendarorder`, `calendarcolor`, `timezone`, `components`, `transparent`, `synctoken`) VALUES
(21, 'principals/testuser', 'testcal', '9CAE8E99-BCE3-4DB8-944E-81154AAD59D6', NULL, 1073741972, '#B90E28FF', 'BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Apple Inc.//Mac OS X 10.9.4//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VTIMEZONE\r\nTZID:Europe/Berlin\r\nBEGIN:DAYLIGHT\r\nTZOFFSETFROM:+0100\r\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU\r\nDTSTART:19810329T020000\r\nTZNAME:MESZ\r\nTZOFFSETTO:+0200\r\nEND:DAYLIGHT\r\nBEGIN:STANDARD\r\nTZOFFSETFROM:+0200\r\nRRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU\r\nDTSTART:19961027T030000\r\nTZNAME:MEZ\r\nTZOFFSETTO:+0100\r\nEND:STANDARD\r\nEND:VTIMEZONE\r\nEND:VCALENDAR\r\n', 'VEVENT', 0, 19);
evert commented 10 years ago

This is indeed a calendar for events, but it has sync-token 19... which would indicate that changes have happened here in the past.

To rule out human error.. could you just delete this calendar, create a new calendar using the browser plugin (as opposed to writing database records manually) and refresh iCal?

c0d3z3r0 commented 10 years ago

A calendar created with the browser plugin is getting synced to iCal. But I still can't add a calendar in iCal. It shows up in iCal but never goes to the DB

evert commented 10 years ago

There's a possibility that because things were messed up earlier, iCal is now in a 'broken state' where it doesn't behave correctly anymore.

I would suggest removing the account entirely and setting it up again. If the problem persists then, we should look a little bit further. I would want to know if the HTTP request is being sent to the server, and which response is coming back from the server.

But first.. lets make sure that you have a 'fresh' environment, so we can rule out any earlier problems.

c0d3z3r0 commented 10 years ago

I already tried this three times without any success. I will now set up a fresh sabre/dav installation and remove all iCal accounts. ... could take some time ;)

evert commented 10 years ago

I'm sorry you have to go through this.

c0d3z3r0 commented 10 years ago

ok... Now I have a completely fresh sabre/dav setup. I added admin to iCal and tried to create a calendar. As before it doesn't get added in dav. Adding a calendar through web interface just works fine.

evert commented 10 years ago

Great that you could go through this process..

Do you have access to your server logs? There should be a log line with MKCALENDAR in there. I'm curious about the contents of that line.

Also let me know which webserver you are using.

c0d3z3r0 commented 10 years ago

hmm no... MKCALENDAR was there where my iPhone tried to sync but not with iCal. Here is the full log since the fresh setup: http://cl.ly/1b2h0h0h0t1P

evert commented 10 years ago

Hmmm I don't really have a clue yet.

Would it be possible to get access to your server? If it's a public url, I would love to try it out myself.

c0d3z3r0 commented 10 years ago

https://privnote.com/n/pchtyebvtlkoyxuv/#mydlikaxkosmjmwr

c0d3z3r0 commented 10 years ago

Tell me if you need the logs

evert commented 10 years ago

Don't need the logs. It works for me. I'm using Calender version 7.0 on OS X 10.9.4.

Creating a calendar worked, and if everything is correct you should see a new calendar with the name 'My calendar' in your database.

This makes me wonder what's different for you!

c0d3z3r0 commented 10 years ago

Yep you're right...
bildschirmfoto 2014-08-01 um 20 07 36

evert commented 10 years ago

So what happens when you create a new calendar? It appears locally and then it disappears again? Or it just stays on your machine but never gets sent to the server?

Are you sure you are creating a calendar in the correct account, and not in the local list of calendars?

c0d3z3r0 commented 10 years ago

No, it doesn't disappear. It stays there like any other calendar but won't go to the database... It is the right account

evert commented 10 years ago

Can you make a screenshot of these calendars? Sorry for all the questions, I'm just trying to figure out what's going on.

evert commented 10 years ago

by the way.. i did not that WebDAV-Sync is still disabled on the server, I would definitely enable that as I am getting unrelated errors. I'm going to track that in a different issue.

c0d3z3r0 commented 10 years ago

just added the sync plugin

bildschirmfoto 2014-08-01 um 20 17 19 bildschirmfoto 2014-08-01 um 20 17 41 bildschirmfoto 2014-08-01 um 20 17 33

c0d3z3r0 commented 10 years ago

Did you add Cal 2 and 3?

bildschirmfoto 2014-08-01 um 20 24 04

evert commented 10 years ago

Yes, I did =)

c0d3z3r0 commented 10 years ago

ok :+1:

evert commented 10 years ago

What happens if you press COMMAND-R

This usually forces iCal to refresh everything for me. I would at least expect those calendars to disappear again.

c0d3z3r0 commented 10 years ago

The newly created Calendars appear but nothing disappears

c0d3z3r0 commented 10 years ago

Just tested iCal in OSX 10.10. It only shows the Calendars in database and I can add new Calendars which are synced to the database

evert commented 10 years ago

Super weird.. I wish I knew where to go from here :S

c0d3z3r0 commented 10 years ago

I'll backup my other calendars and completely reset my iCal... maybe the config is defective

c0d3z3r0 commented 10 years ago

Now it's working \o/ Fix: rm -rf ~/Library/Calendars/ ~/Library/Preferences/com.apple.iCal* reboot <-- because some strange things will happen if you don't o.O

I will try the same on my iPhone tomorrow and then test everything again. And maybe this works also for Contacts

c0d3z3r0 commented 10 years ago

I couldn't wait to try it... everything is working fine now. I did the same on my iPhone: Deleted all accounts; (rm -rf ~/Library/Calendar ~/Library/Preferences/com.apple.mobilecal*); rebooted and setup up the accounts So this fixed issue #493 and #494

Thank you so much for your help! :-)

evert commented 10 years ago

Great to hear! :D Have a good weekend!