My application implements the NSApplicationDelegate method -application:openFile: in its app delegate. There seems to be a problem new to OS 10.8 where after receiving the apple event to open a file, five seconds pass before some kind of internal timeout is hit, a response is sent to the apple event, and the calling app (e.g., applescript editor) proceeds.
In detail, here's what I see. After application:openFile: returns YES, I can see that -[NSAppleEventManager suspendCurrentAppleEvent] is called: #0 0x00007fff8f07b5ed in -[NSAppleEventManager *suspendCurrentAppleEvent*] () #1 0x00007fff8f90458e in -[NSApplication(NSAppleEventHandling) _handleAEOpenDocumentsForURLs:] () #2 0x00007fff8f903b55 in -[NSApplication(NSScripting) handleOpenScriptCommand:] () #3 0x00007fff90770cac in __invoking___ () #4 0x00007fff90770b47 in -[NSInvocation invoke] () #5 0x00007fff90770d19 in -[NSInvocation invokeWithTarget:] () #6 0x00007fff8f10121c in -[NSScriptCommand _sendToRemainingReceivers] () #7 0x00007fff8f1014c6 in -[NSScriptCommand executeCommand] () #8 0x00007fff8f11983a in -[NSScriptingAppleEventHandler handleCommandEvent:withReplyEvent:] () #9 0x00007fff8f00635b in -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] () #10 0x00007fff8f0061bd in _NSAppleEventManagerGenericHandler () #11 0x00007fff93844f68 in aeDispatchAppleEvent () #12 0x00007fff93844dc9 in dispatchEventAndSendReply () #13 0x00007fff93844c89 in aeProcessAppleEvent () #14 0x00007fff8c141e29 in AEProcessAppleEvent () #15 0x00007fff8f6b22a6 in _DPSNextEvent () #16 0x00007fff8f6b1862 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () #17 0x00007fff8f6a8c03 in -[NSApplication run] () #18 0x00007fff8f64d656 in NSApplicationMain () #19 0x0000000100001d7c in main (argc=3, argv=0x7fff5fbff7c0) at main.m:23 After five seconds, -[NSAppleEventManager resumeWithSuspensionID:] is called: #0 0x00007fff8f07b6be in -[NSAppleEventManager *resumeWithSuspensionID*:] () #1 0x00007fff8f90585f in __block_global_1 () #2 0x00007fff9073a4b4 in * __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__* () #3 0x00007fff90739fcd in __CFRunLoopDoTimer () #4 0x00007fff9071f7b9 in __CFRunLoopRun () #5 0x00007fff9071edd2 in CFRunLoopRunSpecific () #6 0x00007fff8c137774 in RunCurrentEventLoopInMode () #7 0x00007fff8c137512 in ReceiveNextEventCommon () #8 0x00007fff8c1373a3 in BlockUntilNextEventMatchingListInMode () #9 0x00007fff8f6b1fa3 in _DPSNextEvent () #10 0x00007fff8f6b1862 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () #11 0x00007fff8f6a8c03 in -[NSApplication run] () #12 0x00007fff8f64d656 in NSApplicationMain () #13 0x0000000100001d7c in main (argc=3, argv=0x7fff5fbff7c0) at main.m:23 Evidently, some kind of timeout was reached since resumeWithSuspensionID: is called from a timer and it is always very close to 5 second between my application:openFile: method returning and resumeWithSuspensionID: being called. After this, things proceed normally: whatever applescript invoked "open file ..." continues at the next statement. There don't appear to be any errors--it just times out waiting for something. I turned on AEDebugSends and AEDebugReceives. Here's what I see up to the timeout: Aug 23 21:26:05 George-Nachmans-MacBook-Air.local iTerm[4819] <Info>: _aeMachPortCallback(), got a message, @ 0x0x7fff5fbfe1f0 size=972 info=0 (_aeMachPortCallback()/AEMach.cp #643) main Aug 23 21:26:05 George-Nachmans-MacBook-Air.local iTerm[4819] <Notice>: AE2000 (4819: Received an event: ------oo start of event oo------ aevt('aevt'\'odoc' transactionID=0 returnID=3711 sourcePSN=[0x0,6f06f "AppleScript Editor"] eventSource=3 sourceUID=501 sourceGID=20 sourceEUID=501 sourceEGID=20 sourcePID=3551 auditToken=[501,501,20,501,20,3551,100005,3551]{ '----':obj ('obj '{ 'form':enum('name'), 'want':type('file'), 'seld':utxt('utxt'(TEXT("Macintosh HD:Users:georgen:Library:Application Support:iTerm:version.txt"))), 'from':null() }), &'csig':magn(65536) }) ------oo end of event oo------ (aeProcessIncomingEvent()/AEMach.cp #1445) main 2012-08-23 21:26:05.451 iTerm[4819:707] Command: NSCoreSuite.Open Direct Parameter: /Users/georgen/Library/Application Support/iTerm/version.txt Receivers: (null) Arguments: { "" = "/Users/georgen/Library/Application Support/iTerm/version.txt"; } Then, after the timeout I see this (which is logged because I also set NSScriptingDebugLogLevel to 1): 2012-08-23 21:26:36.347 iTerm[4819:707] Result: <null> My openFile: method doesn't do anything besides return YES. Is there something else I need to do to make the framework happy? Thanks, George _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com