2012-02-14 46 views
1

我正在我的可可應用程序中做一個簡單的文件打開面板。我啓用權利和應用程序沙盒,現在下面的代碼給我setFloatingPanel上的錯誤。無法弄清楚爲什麼?NSOpenPanel在可可應用程序與應用程序沙盒給出了一個錯誤

NSArray* fileTypes = [[NSArray alloc] initWithObjects:@"png", @"PNG", nil]; 
NSOpenPanel *panel; 
panel = [NSOpenPanel openPanel]; 
[panel setTitle:@"Select Photo"]; 
[panel setFloatingPanel:YES]; 

結果在下面的錯誤

2012-02-14 11:43:45.831 MyApp[451:707] -[NSRemoteOpenPanel setFloatingPanel:]: unrecognized selector sent to instance 0x400886ea0 
2012-02-14 11:43:45.832 MyApp[451:707] -[NSRemoteOpenPanel setFloatingPanel:]: unrecognized selector sent to instance 0x400886ea0 
2012-02-14 11:43:45.837 MyApp[451:707] (
    0 CoreFoundation      0x00007fff83b18286 __exceptionPreprocess + 198 
    1 libobjc.A.dylib      0x00007fff8b7f0d5e objc_exception_throw + 43 
    2 CoreFoundation      0x00007fff83ba44ce -[NSObject doesNotRecognizeSelector:] + 190 
    3 CoreFoundation      0x00007fff83b05133 ___forwarding___ + 371 
    4 CoreFoundation      0x00007fff83b04f48 _CF_forwarding_prep_0 + 232 
    5 MyApp        0x0000000100019f77 openFiles + 519 
    6 MyApp        0x0000000100012b19 -[MyController addImageButtonClicked:] + 25 
    7 CoreFoundation      0x00007fff83b07a1d -[NSObject performSelector:withObject:] + 61 
    8 AppKit        0x00007fff878d9710 -[NSApplication sendAction:to:from:] + 139 
    9 AppKit        0x00007fff878d9642 -[NSControl sendAction:to:] + 88 
    10 AppKit        0x00007fff878d956d -[NSCell _sendActionFrom:] + 137 
    11 AppKit        0x00007fff878d8a30 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 2014 
    12 AppKit        0x00007fff879588e0 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 489 
    13 AppKit        0x00007fff878d763a -[NSControl mouseDown:] + 786 
    14 AppKit        0x00007fff878a20e0 -[NSWindow sendEvent:] + 6306 
    15 AppKit        0x00007fff8783a68f -[NSApplication sendEvent:] + 5593 
    16 AppKit        0x00007fff877d0682 -[NSApplication run] + 555 
    17 AppKit        0x00007fff87a4f80c NSApplicationMain + 867 
    18 MyApp        0x0000000100001f4c main + 44 
    19 MyApp        0x0000000100001f14 start + 52 
    20 ???         0x0000000000000003 0x0 + 3 
) 
+0

試試這個http://stackoverflow.com/questions/17925611/sandboxed-app-nsopenpanel-causes-crashes/18378725#18378725 – Benz 2013-08-22 11:11:48

回答

3

正如你剛纔提到您啓用了應用程序沙箱,這可以解釋爲什麼你在你的崩潰日誌看到NSRemoteOpenPanel

顯然,蘋果的NSRemoteOpenPanel不會NSOpenPanelNSSavePanelNSPanel下降(這哪裏是setFloatingPanel方法被定義)。

我在http://bugreporter.apple.com

建議提交增強請求(或缺陷),這也可能是蘋果不希望沙盒應用程序有生活在其中的「正常」的窗口層外浮動面板或窗口,在這種情況下,您的bug將會很快關閉或評論。

+1

在沙盒應用程序中打開並保存面板由外部進程PowerBox處理。因此,在沙盒應用程序中打開和保存面板有很多限制。 – 2012-02-14 07:19:25

相關問題