How to integrate Finder Sync Extensions with Xcode in Cocoa

1.8k views Asked by At

I want to use Finder Sync Extensions exactly like Dropbox like add toolbar icon and update the badge icons while syncing using Objective C in Xcode.
I searched in google a lot but I could not found any sample code related to this.

I found only one link for that Finder Sync.

But i want to know the sample procedure to integrate Finder Sync Extension as an example or code for more understanding.

Thanks in adv..!!

2

There are 2 answers

0
Chilledheart On

I am the author of Seafile's Finder Sync Extension code. Thanks for post the link to my code. I have improved the code overtime since the first publish.

The architecture is much simpler than what's the windows' explorer extension programming. Firstly you need to tell Finder (or FIFinderSyncController) which directories you want to watch (via setting directoryURLs), and the FIFinderSyncController will callback via beginObservingDirectoryAtURL when the user visits some directory in Finder. Then if the specific files in the directory are visited the first time after requestBadgeIdentifierForURL call, you will be called back with requestBadgeIdentifierForURL. You should record this information if you want to update the badge later. Finally you can set badge on your files whenever possible in the main queue via setBadgeIdentifier.

Another important thing to mention is, as the official document says, that the Extension is running in another process (neither the threads from Finder nor those from your apps) and talking with Finder via XPC. And you might need to interact with your extension via some kind of IPC such as XPC or mach ports since the extension is required to be sandboxed.

I hope this information will help you with your code.

0
Sheen Vempeny On

Finder sync extension provides the support for icon overlay. You have to write your own code for sync the files with server and computer and you can display the sync status on Finder with finder sync extension support. Please check this link for example - https://github.com/haiwen/seafile-client/blob/7d73ba314aedbd7a05428de649ce2a1cce37f676/fsplugin/FinderSync.mm