我尝试运行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
类的方法中:SampleFTPExportPlugIn
ApertureExportManager
_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 网页安装了另一个插件,其中包含安装程序和所有内容。那个在调用时也失败了......