Final Cut Pro X のプラグインを使用しており、別のプログラムにデータを送信する必要があります。これまでのところ、を使用してそれを行うことができましたNSDistributedNotificationCenter
が、それは機能しないはずです。そのApple Developerページによると:
重要: サンドボックス化されたアプリは、辞書が含まれていない場合にのみ通知を送信できます。送信アプリケーションがアプリ サンドボックスにある場合、notificationInfo は nil である必要があります。
Final Cut Pro X は Mac App Store で販売されており、私が見たものはすべてサンドボックス化されていることを示しています。FCPX のサンドボックスにバグがあるのか、分散通知センターにバグがあるのか、それとも FxPlugs がサンドボックスの外で実行されているのか、誰か知っていますか? 私はむしろ、機能するが想定されていないものに重要なコードを依存させません。
FxPlug でコードを送信する私の通知:
NSDistributedNotificationCenter* dist = [NSDistributedNotificationCenter defaultCenter];
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:@"First value", @"key1",
@"Second value from FCPX", @"key2", @"Third & final value", @"3key3", nil];
[dist postNotificationName:@"FCPX plugin"
object:@"SFPCommApp"
userInfo:dict];
他のアプリでコードを受け取る:
m_center = [NSDistributedNotificationCenter defaultCenter];
[m_center addObserver:self
selector:@selector(GetNotification:)
name:nil
object:listenTo];
// in GetNotification
NSString *notifString = [notification description];
NSString *dispString = @"Got notification from Final Cut Pro X";
dispString = [dispString stringByAppendingString:notifString];
// dispString displayed in a dialog
Xcode デバッガーと完全に Xcode の外部 (どちらも Finder から起動) で動作します。また、10.6 をサポートする必要があるため、XPC を使用できません。
FxPlug からデータを送信する他の方法についてのアイデアはありますか? ありがとう!