我正在将FinderSync扩展集成到我的可可应用程序中,以便在文件和文件夹中显示徽章。请看以下两种场景:


有人知道如何使用第二种方案在系统首选项中启用Finder扩展吗?
发布于 2015-07-07 09:50:36
我找到了解决办法:
启用扩展的代码(包ID)
system("pluginkit -e use -i YourAppBundleID")禁用扩展的代码(包ID)
system("pluginkit -e ignore -i YourAppBundleID")在我使用之前:
system("pluginkit -e use -i AppBundleID.FinderSync")所以只要去掉".FinderSync“就行了。
发布于 2015-07-06 22:07:03
非调试方案(#if!调试):
system("pluginkit -e use -i com.domain.my-finder-extension");在调试器下运行时,直接给出扩展的路径:
NSString *pluginPath = [[[NSBundle mainBundle] builtInPlugInsPath] stringByAppendingPathComponent:@"My Finder Extension.appex"];
NSString *pluginkitString = [NSString stringWithFormat:@"pluginkit -e use -a \"%@\"", pluginPath];
system([pluginkitString cStringUsingEncoding:NSUTF8StringEncoding]);在applicationDidFinishLaunching方法中指定这一点。您还应该手动打开它一次,这样如果用户在系统首选项中关闭了扩展,那么应用程序启动时就不会打开它。在用户第一次启动具有finder同步扩展支持的应用程序时,我设置了一个NSUserDefaults键。
https://stackoverflow.com/questions/31176942
复制相似问题