2015-12-09 16 views
7

Ho un'applicazione in esecuzione nella sandbox che avvia un bundle di applicazioni di supporto utilizzando NSTask (l'helper è contenuto nel bundle dell'app).Arresto NSOpenPanel nel processo ereditato sandbox

Utilizzando le autorizzazioni corrette, l'app principale è in grado di avviare l'helper tramite NSTask e la sandbox viene ereditata senza arresti anomali. L'unico problema sembra essere quando apro un NSOpenPanel ottengo il crash qui sotto. Si noti che l'app chiamante non si blocca quando si usa NSOpenPanel, solo l'helper.

Questo sembra un bug nel sistema, quindi forse se qualcuno lo ha incontrato prima c'è una soluzione per questo.

Qui ci sono i diritti per l'applicazione principale:

<?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> 

I diritti per l'aiutante:

<?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> 

Il crash quando NSOpenPanel si apre:

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

Ok, ho perso quella parte 'Si prega di notare che l'app chiamante non si blocca quando si utilizza NSOpenPanel, solo l'helper. – kisileno

+1

@GenericPtr, hai mai capito che cosa stava causando questo problema? –

risposta

3

si è arenata anche in questo. Il problema è che la mia app non aveva i permessi necessari per consentire questa operazione.

Add file Read/Write entitlements

Nelle impostazioni di progetto, sotto App Sandbox>File Accesso>utente selezionato File e selezionarelettura/scrittura.

+1

So che non dovrei postare pensieri del genere, ma - grazie! E 'stato. – solgar