2015-12-09 19 views
7

我有一個應用程序在沙箱中運行,該沙箱使用NSTask(幫助程序包含在應用程序包中)啓動幫助程序包。沙箱中的NSOpenPanel崩潰繼承進程

使用正確的權利,主應用程序能夠使用NSTask啓動幫助程序,並且沙箱會繼承而不會崩潰。唯一的問題似乎是當我打開一個NSOpenPanel時,我得到下面的崩潰。請注意,使用NSOpenPanel時,調用者應用程序不會崩潰,只是幫助程序。

這看起來像是系統中的一個錯誤,所以也許如果有人遇到過這個問題,那麼有一個解決方法。

下面是主要的應用程序的權利:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
<plist version="1.0"> 
<dict> 
    <key>com.apple.security.app-sandbox</key> 
    <true/> 
    <key>com.apple.security.device.usb</key> 
    <true/> 
    <key>com.apple.security.files.bookmarks.app-scope</key> 
    <true/> 
    <key>com.apple.security.device.serial</key> 
    <true/> 
    <key>com.apple.security.network.client</key> 
    <true/> 
    <key>com.apple.security.files.user-selected.read-write</key> 
    <true/> 
</dict> 
</plist> 

爲輔助的權利:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
<plist version="1.0"> 
<dict> 
    <key>com.apple.security.app-sandbox</key> 
    <true/> 
    <key>com.apple.security.inherit</key> 
    <true/> 
</dict> 
</plist> 

時NSOpenPanel打開崩潰:我擱淺

2015-12-09 10:35:56.879 Desktops[29807:22090051] -[NSVBSavePanel init] caught non-fatal NSObjectNotAvailableException 'service com.apple.appkit.xpc.openAndSavePanelService failed to init an instance of NSOpenPanelService on behalf of <NSLayerCentricRemoteView: 0x1077fd0> due to { 
    callStackSymbols = (
    0 CoreFoundation      0x00007fff8f375e32 __exceptionPreprocess + 178 
    1 libobjc.A.dylib      0x00007fff855084fa objc_exception_throw + 48 
    2 CoreFoundation      0x00007fff8f3dc65d +[NSException raise:format:] + 205 
    3 com.apple.appkit.xpc.openAndSavePanelService 0x000000010879493a com.apple.appkit.xpc.openAndSavePanelService + 6458 
    4 AppKit        0x00007fff87e4a662 -[NSViewController _loadViewIfRequired] + 75 
    5 AppKit        0x00007fff87e4a5cd -[NSViewController view] + 30 
    6 ViewBridge       0x00007fff9180dbab -[NSViewServiceMarshal _bootstrap:replyData:] + 11432 
    7 ViewBridge       0x00007fff9180efb5 -[NSViewServiceMarshal bootstrap:withReply:] + 124 
    8 CoreFoundation      0x00007fff8f2e7b5c __invoking___ + 140 
    9 CoreFoundation      0x00007fff8f2e79ee -[NSInvocation invoke] + 286 
    10 CoreFoundation      0x00007fff8f302e36 -[NSInvocation invokeWithTarget:] + 54 
    11 ViewBridge       0x00007fff91847f01 -[NSVB_ViewServiceImplicitAnimationDecodingProxy forwardInvocation:] + 264 
    12 CoreFoundation      0x00007fff8f2e6472 ___forwarding___ + 514 
    13 CoreFoundation      0x00007fff8f2e61e8 _CF_forwarding_prep_0 + 120 
    14 CoreFoundation      0x00007fff8f2e7b5c __invoking___ + 140 
    15 CoreFoundation      0x00007fff8f2e79ee -[NSInvocation invoke] + 286 
    16 CoreFoundation      0x00007fff8f302e36 -[NSInvocation invokeWithTarget:] + 54 
    17 ViewBridge       0x00007fff918189fa -[NSVB_QueueingProxy forwardInvocation:] + 323 
    18 CoreFoundation      0x00007fff8f2e6472 ___forwarding___ + 514 
    19 CoreFoundation      0x00007fff8f2e61e8 _CF_forwarding_prep_0 + 120 
    20 CoreFoundation      0x00007fff8f2e7b5c __invoking___ + 140 
    21 CoreFoundation      0x00007fff8f2e79ee -[NSInvocation invoke] + 286 
    22 CoreFoundation      0x00007fff8f302e36 -[NSInvocation invokeWithTarget:] + 54 
    23 CoreFoundation      0x00007fff8f2e6472 ___forwarding___ + 514 
    24 CoreFoundation      0x00007fff8f2e61e8 _CF_forwarding_prep_0 + 120 
    25 CoreFoundation      0x00007fff8f2e7b5c __invoking___ + 140 
    26 CoreFoundation      0x00007fff8f2e79ee -[NSInvocation invoke] + 286 
    27 ViewBridge       0x00007fff918573db withHintInProgress + 501 
    28 ViewBridge       0x00007fff91857161 __deferNSXPCInvocationOntoMainThread_block_invoke_2 + 220 
    29 ViewBridge       0x00007fff917f5c3f +[NSViewServiceApplication withHostPID:invoke:] + 46 
    30 ViewBridge       0x00007fff9185702f __deferNSXPCInvocationOntoMainThread_block_invoke + 129 
    31 ViewBridge       0x00007fff91856c3a __deferBlockOntoMainThread_block_invoke_2 + 448 
    32 CoreFoundation      0x00007fff8f30b4dc __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12 
    33 CoreFoundation      0x00007fff8f2eadf5 __CFRunLoopDoBlocks + 341 
    34 CoreFoundation      0x00007fff8f2eab5b __CFRunLoopRun + 2347 
    35 CoreFoundation      0x00007fff8f2e9fc8 CFRunLoopRunSpecific + 296 
    36 HIToolbox       0x00007fff86193d55 RunCurrentEventLoopInMode + 235 
    37 HIToolbox       0x00007fff86193b8f ReceiveNextEventCommon + 432 
    38 HIToolbox       0x00007fff861939cf _BlockUntilNextEventMatchingListInModeWithFilter + 71 
    39 AppKit        0x00007fff87e01d96 _DPSNextEvent + 1067 
    40 AppKit        0x00007fff87e011c5 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454 
    41 ViewBridge       0x00007fff917f6c11 -[NSViewServiceApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 73 
    42 AppKit        0x00007fff87df5d28 -[NSApplication run] + 682 
    43 AppKit        0x00007fff87dbefbe NSApplicationMain + 1176 
    44 libxpc.dylib      0x00007fff91ee24f2 _xpc_objc_main + 793 
    45 libxpc.dylib      0x00007fff91ee0f1e xpc_main + 494 
    46 ViewBridge       0x00007fff9181c7b7 xpc_connection_handler + 0 
    47 ViewBridge       0x00007fff917faac9 NSViewServiceApplicationMain + 2818 
    48 com.apple.appkit.xpc.openAndSavePanelService 0x00000001087996ec main + 208 
    49 libdyld.dylib      0x00007fff896d85ad start + 1 
    50 ???         0x0000000000000001 0x0 + 1 
); 
    name = NSInternalInconsistencyException; 
    reason = "+[NSOpenAndSavePanelService loadViewToService:isOpenPanel:appCentric:] : failed entitlements check"; 
    userInfo = "<null>"; 
}' with backtrace (
    0 CoreFoundation      0x904a2c19 __raiseError + 201 
    1 libobjc.A.dylib      0x99387f11 objc_exception_throw + 276 
    2 ViewBridge       0x981b5cff __62-[NSRemoteViewBase advanceToConfigPhase:awaitingWindowRights:]_block_invoke + 0 
    3 ViewBridge       0x981b4518 -[NSRemoteViewBase advanceToConfigPhase] + 49 
    4 ViewBridge       0x981b6645 -[NSRemoteViewBase viewServiceMarshalProxy:withDetailedErrorHandler:] + 228 
    5 ViewBridge       0x981b6ace -[NSRemoteViewBase viewServiceMarshalProxy:withErrorHandler:] + 109 
    6 ViewBridge       0x981b62ce -[NSRemoteViewBase viewServiceMarshalProxy:] + 48 
    7 ViewBridge       0x981a88b5 -[NSRemoteViewBase bridge] + 255 
    8 AppKit        0x94e7e03c -[NSVBSavePanel init] + 689 
    9 AppKit        0x94e7dcfd +[NSSavePanel newRemotePanel] + 357 
    10 AppKit        0x94e7d94f +[NSSavePanel _crunchyRawUnbonedPanel] + 108 
    11 AppKit        0x94e7d8de +[NSOpenPanel openPanel] + 33 
    12 Desktops       0x000c7935 -[TDesktopInfoController choosePicture:] + 101 
    13 libobjc.A.dylib      0x993819e4 -[NSObject performSelector:withObject:] + 70 
    14 AppKit        0x94e7d556 __36-[NSApplication sendAction:to:from:]_block_invoke + 51 
    15 libsystem_trace.dylib    0x9a8b13c9 _os_activity_initiate + 85 
    16 AppKit        0x94e7d477 -[NSApplication sendAction:to:from:] + 610 
    17 AppKit        0x94e90e69 -[NSControl sendAction:to:] + 102 
    18 AppKit        0x94e90d5d __26-[NSCell _sendActionFrom:]_block_invoke + 176 
    19 libsystem_trace.dylib    0x9a8b13c9 _os_activity_initiate + 85 
    20 AppKit        0x94e90c8c -[NSCell _sendActionFrom:] + 161 
    21 AppKit        0x950ed08d __48-[NSCell trackMouse:inRect:ofView:untilMouseUp:]_block_invoke1010 + 43 
    22 libsystem_trace.dylib    0x9a8b13c9 _os_activity_initiate + 85 
    23 AppKit        0x94e8f039 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 2744 
    24 AppKit        0x94edb64b -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 809 
    25 AppKit        0x94e8d668 -[NSControl mouseDown:] + 693 
    26 AppKit        0x9547abff -[NSWindow _handleMouseDownEvent:isDelayedEvent:] + 6266 
    27 AppKit        0x9547c406 -[NSWindow _reallySendEvent:isDelayedEvent:] + 2303 
    28 AppKit        0x94e1971f -[NSWindow sendEvent:] + 567 
    29 AppKit        0x94d94bf2 -[NSApplication sendEvent:] + 2919 
    30 AppKit        0x94be807b -[NSApplication run] + 1159 
    31 AppKit        0x94bae6a4 NSApplicationMain + 1630 
    32 Desktops       0x0007b27e +[TAppController Main] + 46 
    33 Desktops       0x00011f7a PASCALMAIN + 90 
    34 Desktops       0x00011f10 main + 32 
    35 Desktops       0x00011ecd start + 253 
    36 Desktops       0x00011df8 start + 40 
) 
+0

好吧,我錯過了那部分'請注意,使用NSOpenPanel時,調用者應用程序不會崩潰,只是助手。' – kisileno

+1

@GenericPtr,你有沒有想過是什麼導致了這個問題? –

回答

3

在這也是。問題最終導致我的應用程序缺少爲執行此操作而配置的必要權利。

Add file Read/Write entitlements

在您的項目設置,下應用沙盒>文件訪問>用戶選擇文件和選擇讀/寫

+1

我知道我不應該這樣想,但是 - 謝謝!就是這樣。 – solgar