LoginSignup
2
2

More than 5 years have passed since last update.

OS X, Finder Sync Extension 開発のTips

Last updated at Posted at 2015-10-05

App Extension をコマンドラインで制御

有効にする

enable
$ pluginkit -e use -i com.example.ExampleOSX.FinderSync

無効にする

disable
$ pluginkit -e ignore -i com.example.ExampleOSX.FinderSync

情報の確認

  • App Extension のパスを確認する
$ pluginkit -m -A -i com.example.ExampleOSX.FinderSync -v
+    com.example.ExampleOSX.FinderSync(1.8.0)   7764BDF3-7C1B-410F-B1B0-34B07FA26E98    2015-10-01 03:18:54 +0000   /Applications/Example.app/Contents/PlugIns/FinderSync.appex
 (1 plug-in)

有効/無効を コードから制御する

  • system()
  • NSTask
  • NSAppleScript

を使います。

system("pluginkit -e use -i com.example.ExampleOSX.FinderSync");

コンテナアプリとApp Extension とのプロセス間通信

  • MMWormhole を使うと良いです
  • CFNotificationCenterGetDarwinNotifyCenter() で取得できる Darwin Notify Center と、App Group のコンテナ $HOME/Library/Group Containers を使って実現しています

システム環境設定を表示する

NSURL *url = [NSURL fileURLWithPath:@"/System/Library/PreferencePanes/Extensions.prefPane"];
[[NSWorkspace sharedWorkspace] openURL:url];

Debug

App Extension が更新されない場合

  1. システム環境>機能拡張で当該 Extension を無効にしてから
  2. Xcode で Clean してから Build します

selectedItemURLs

  • [[FIFinderSyncController defaultController] selectedItemURLs]の各要素のURLは、file:///.file/id=8438323.161のような形式なっています
  • パスに変換する場合は、fileSystemRepresentationを使います

動作ログ

  • tail -f /var/log/system.logConsole.app で確認します

参考

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2