【问题标题】:Are FxPlugs sandboxed inside Final Cut Pro X?FxPlugs 是否在 Final Cut Pro X 中进行沙盒处理?
【发布时间】:2013-06-10 19:19:32
【问题描述】:

我正在使用 Final Cut Pro X 的插件,需要将数据发送到另一个程序。到目前为止,我可以通过使用NSDistributedNotificationCenter 来做到这一点,但这是不应该工作。根据其 Apple 开发者页面:

重要提示:沙盒应用只有在不包含字典的情况下才能发送通知。如果发送应用在 App Sandbox 中,notificationInfo 必须为 nil。

Final Cut Pro X 在 Mac App Store 中出售,我所看到的一切都表明它被沙盒化了。有谁知道 FCPX 的沙箱、分布式通知中心是否存在错误,或者 FxPlug 是否在沙箱之外运行?我宁愿不让关键代码依赖于有效但不应该依赖的东西。

我在 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 发送数据的其他方法的想法?谢谢!

【问题讨论】:

    标签: plugins sandbox finalcut


    【解决方案1】:

    如果您从Apple's developer site 下载最新的 FxPlug SDK (3.0),它包含用于使用 XPC 构建 FxPlug 的更新示例。 Final Cut Pro X 尚未沙盒化,但似乎未来可能会。

    【讨论】:

    • 2 年后快速更新此答案,FCP X 仍未在沙箱中运行(使用活动监视器中的沙箱列进行检查)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-05
    相关资源
    最近更新 更多