我嘗試運行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