Sunday, May 25, 2008

Safari bookmarks and Sync Services


For my own purposes, I need to make a Cocoa program that knows about my bookmarks in Safari. Lucky for me, Safari submits its bookmarks to Sync Services, according to Syncrospector:



To complete my evil plan, I also need to know the last time I clicked on a bookmark. Lucky for me, the sync schema includes a "last visited date", according to /Applications/Safari.app/Contents/SafariSyncClient.app/ Contents/Resources/SafariClientDescription.plist:


<key>Entities</key>
<dict>
    <key>com.apple.bookmarks.Bookmark</key>
    <array>
        <string>url</string>
        <string>last visited date</string>
        <string>name</string>
        <string>position</string>
        <string>notes</string>
        <string>parent</string>
        <string>com.apple.syncservices.RecordEntityName</string>
    </array>


So I just need to write my own Sync Services client that syncs with the com.apple.bookmarks.Bookmark(s)...

Uh oh. Let's have another look at that Syncrospector screenshot. The displayed entity there is a Bookmark, but it doesn't appear to have a "last visited date" property. Neither do any of the others.

I went ahead and made my own Sync Services client, so I could poke around in there for myself, but it sure seems to be that Safari doesn't set that property on the bookmarks that it submits to the truth database (it's not required to) even though Apple's own sync schema defines such a property.

Bah. Back to the drawing board for me.

No comments: