Finder Sync Extension - Badge update

I have created a main app and added finder sync extension as the target for main app. When user click on a folder, requestforBadgeIdentifier() gets invoked, I'm able to show initial badge icon during that time. But I need to update the badge later based on some condition (synching process).

Folder contents are synched using another process. Once synching is completed, I want to update the badges from that process.

Can I invoke the below API from another process (not from finder sync extension)?
FIFinderSyncController.default().setBadgeIdentifier("cloud", for: url)

Answered by maju in 622905022
Thanks Quinn

Can I invoke the below API from another process (not from finder sync extension)?

No.

My generally recommendation on this front is that you have a central process that coordinates all of this work and then you have each FinderSync extension instance connect to that process via XPC. Then, when something changes, the central process can notify the extensions which then call this API.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Ok. Thanks. I have 2 more questions. When you say central process can notify extensions, are you talking about invoking protocol functions and then protocol implmenentatin will trigger setBadgeIndsetifier().

Can I add XPC target for finder sync extension appex and connect from another app (main app)?

When you say central process can notify extensions, are you talking about invoking protocol functions …

No. I’m talking about doing the core work in an entirely separate process. Thus, this notification would require some sort of IPC (ideally using XPC).

Can I add XPC target for finder sync extension appex and connect from another app (main app)?

Unfortunately it’s not possible to set up an XPC Service that’s shared between your app and your appex (r. 22707607). The current workaround is to use a ServiceManagement login item, as shown by the AppSandboxLoginItemXPCDemo sample code.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Thanks Quinn.

How do I communicate if central process is written using Python?

How do I communicate if central process is written using Python?

You might be able to make some progress calling NSXPCConnection directly from PyObjC but I suspect that, overall, you’d be better off managing the IPC from a native language (Objective-C or Swift) and then invoke your Python core from their (either via another IPC mechanism that’s more Python friendly, or by running the Python code using a Python runtime within your native process).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Accepted Answer
Thanks Quinn
Finder Sync Extension - Badge update
 
 
Q