1

I'm working with plugins for Final Cut Pro X and need to send data out to another program. So far I was able to do it by using NSDistributedNotificationCenter but that is not supposed to work. According to its Apple Developer page:

Important: Sandboxed apps can send notifications only if they do not contain a dictionary. If the sending application is in an App Sandbox, notificationInfo must be nil.

Final Cut Pro X is sold in the Mac App Store and everything I've seen points to it being sandboxed. Does anyone know if there's a bug with FCPX's sandbox, with the distributed notification center, or are FxPlugs run outside the sandbox? I rather not have critical code rely on something that works but isn't supposed to.

My notification sending code in the 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];

And receiving code in the other app:

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

It works in the Xcode debugger and entirely outside Xcode (both launched from Finder). Also, I need to support 10.6 so can't use XPC.

Ideas on other methods to send data out from an FxPlug? Thanks!

4

1 回答 1

2

如果您从Apple 的开发人员站点下载最新的 FxPlug SDK (3.0) ,它包含用于使用 XPC 构建 FxPlug 的更新示例。Final Cut Pro X 还没有被沙盒化,但它似乎很可能会在未来被沙盒化。

于 2014-01-02T08:37:41.590 回答