我尝试运行SampleFTPExportPlugIn,它附带了Aperture SDK 2.1。我必须调整Base SDK设置并手动将PluginManager.Framework文件夹复制到/ Library/Frameworks,如here所述。光圈EXC_BAD_ACCESS插件崩溃
All compiles and Aperture 3.2.3现在提供菜单项File/Export/FTP。
选择“FTP”导出方法从而触发插件代码时,Aperture会崩溃并显示EXC_BAD_ACCESS。到
_exportManager = [[_apiManager apiForProtocol:@protocol(ApertureExportManager)] retain];
这是得到了控制后光圈手执行的插件和第二行看来:试图让到ApertureExportManager
参考时,非法的内存访问发生在SampleFTPExportPlugIn
类的initWithAPIManager
方法成为在任何Aperture插件中获得对ApertureExportManager
的参考的标准方式(我还没有找到任何可以在任何地方实现相同的方法)。
这里的堆栈跟踪:
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
,因为这输出reviels:
NSLog(@"_apiManager class is: %@", [[_apiManager class] description]);
然后调用respondsToSelector
会导致相同的崩溃,尽管此方法是从NSObject继承的。
if ([_apiManager respondsToSelector:@selector(apiForProtocol:)]) {
NSLog(@"responds");
}
的_apiManager本身把自己描述为:
_apiManager is: <[*<PROBundleHandler: 0x14d79130> (PROAPIAccessing)*]>
仍然停留...
编辑:
所以看起来光圈传递一个指针点到涅... ......但是,我刚刚从苹果网页安装了另一个插件,安装程序和一切。那个在调用时也失败了......
我也有这个问题,虽然它似乎并不特定于Aperture 3.2。我有一个最初为Aperture 3.1使用Snow Leopard(XCode 4.3?)构建的插件;现在完全相同的代码会导致在我尝试的任何版本的Aperture(3.1,3.2或3.3)上发生上述崩溃。这是使用OSX 10.8和XCode 4.5.1。 – Graham