6

我尝试运行Aperture SDK 2.1附带的SampleFTPExportPlugIn。我不得不调整 Base SDK 设置并手动将 PluginManager.Framework 文件夹复制到 /Library/Frameworks,如此所述。

所有编译和Aperture 3.2.3现在提供菜单项 File/Export/FTP。

When selecting the "FTP" export method and thus triggering the plug-in code, Aperture crashes with a EXC_BAD_ACCESS. 当试图获取对的引用时,非法内存访问发生在initWithAPIManager类的方法中:SampleFTPExportPlugInApertureExportManager

   _exportManager = [[_apiManager apiForProtocol:@protocol(ApertureExportManager)] retain];

这是 Aperture 将控制权交给插件后执行的第二行,似乎是ApertureExportManager在任何 Aperture 插件中获取对任何地方)。

这里是堆栈跟踪:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: 0x000000000000000d, 0x0000000000000000

VM Regions Near 0:
--> 
    __TEXT                 0000000100000000-0000000100798000 [ 7776K] r-x/rwx SM=COW  /Applications/Aperture.app/Contents/MacOS/Aperture

Application Specific Information:
objc_msgSend() selector name: class
objc[3000]: garbage collection is OFF
Performing @selector(a_exportPlugIn:) from sender NSMenuItem 0x111d2a540

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                 0x00007fff8711c090 objc_msgSend_vtable2 + 16
1   com.apple.CoreFoundation        0x00007fff8381e25f -[__NSCFString isEqualToString:] + 63
2   com.apple.PluginManager         0x0000000101211218 -[PROBundleHandler apiForProtocol:] + 109
3   com.apple.CoreFoundation        0x00007fff83852f4c __invoking___ + 140
4   com.apple.CoreFoundation        0x00007fff83852de4 -[NSInvocation invoke] + 132
5   com.apple.CoreFoundation        0x00007fff83852fb4 -[NSInvocation invokeWithTarget:] + 52
6   com.apple.CoreFoundation        0x00007fff8384dff4 ___forwarding___ + 756
7   com.apple.CoreFoundation        0x00007fff8384dc88 _CF_forwarding_prep_0 + 232
8   com.apple.SampleFTPExportPlugIn 0x000000012c0d5361 -[SampleFTPExportPlugIn initWithAPIManager:] + 209
9   com.apple.PluginManager         0x000000010120c6fa -[PROConcretePlugIn plugInInstance] + 212

我阅读了有关 Objective-C 内存管理的所有内容,但无法理解它。我在网上找到的所有其他示例都是这样实现的,所以我想我有一个兼容性问题,我的 Aperture / Library 安装中缺少一些东西。如何缩小问题范围?

编辑:

问题似乎与传入的 apiManager 有关。方法签名是:

     - (id)initWithAPIManager:(id<PROAPIAccessing>)apiManager

然后将该参数分配给我们的内部引用:

  _apiManager = apiManager;

然而,传入的实际类是PROPlugInFirewall,因为这个输出很有趣:

   NSLog(@"_apiManager class is: %@", [[_apiManager class] description]);

然后调用respondsToSelector导致同样的崩溃虽然这个方法是从 NSObject 继承的。

   if ( [_apiManager respondsToSelector:@selector(apiForProtocol:)] ) {
        NSLog(@"responds");
    }

_apiManager 本身将自己描述为:

   _apiManager is: <[*<PROBundleHandler: 0x14d79130> (PROAPIAccessing)*]>

还是卡住了...

编辑:

所以看起来 Aperture 正在传递一个指向涅槃的指针......但是,我刚刚从 Apple 网页安装了另一个插件,其中包含安装程序和所有内容。那个在调用时也失败了......

4

2 回答 2

2
  • 下载 FXPlug 1.2.5 SDK
  • 打开安装包的内容
  • 将 PluginManager.framework 复制到 /Library/Frameworks

您的插件现在应该可以工作了!

FXPlug SDK(2.2/2.4) 中较新版本的 PluginManager.framework 将导致此崩溃。

使用 Xcode 4.5 在 10.8 上测试

于 2013-01-17T05:59:21.933 回答
1

我发现上面 Justin 的回答在需要为 Aperture 3.4 构建时对我不起作用,因为它需要 FXPlug 1.x 版本不支持的 x86_64 架构。

在尝试了各种版本的 PluginManager 框架后,我发现这里可用的版本不会导致上述崩溃,并且还包含有效的 64 位架构。只需将 /Library/Frameworks/PluginManager.framework/Versions/B 的内容替换为链接存档的内容即可。

于 2013-03-07T01:02:13.750 回答