我使用标准架构(64 位 Intel)(x86_64)、SDK:最新的 OSX(OSX 10.9)和部署目标:10.8 使用 Xcode 5.1.1 构建了应用程序。
打开 NSSavePanel 后,一旦用户单击文件夹,应用程序就会崩溃。以下是代码片段和崩溃日志。这个问题在我的开发 macbook(操作系统:10.9.5)中没有发生。它只发生在客户端的macbook(操作系统:10.8.2)中。顺便说一句,我无法在客户的 macbook 中运行 Xcode。
-(IBAction)onSaveScriptFileAs:(id)sender
{
NSSavePanel *theSavePanel = [NSSavePanel savePanel];
[theSavePanel setTitle:@"Save Test Script As"];
[theSavePanel setAllowedFileTypes:[NSArray arrayWithObject:@"ts"]];
if (tempScriptFileName != nil) {
[theSavePanel setNameFieldStringValue:tempScriptFileName];
}
if ([theSavePanel runModal] == NSFileHandlingPanelOKButton)
{
[self saveScriptFile:[[theSavePanel URL] path]];
[self setTempScriptFileName:nil];
}
}
崩溃日志:
Process: MyAppName [5480]
Path: /Volumes/VOLUME/*/MyAppName5.18.85b.app/Contents/MacOS/MyAppName
Identifier: com.MyAppName
Version: 5.18.85b (5.18.85b)
Code Type: X86-64 (Native)
Parent Process: launchd [202]
User ID: 502
Date/Time: 2014-09-15 09:28:58.781 -0700
OS Version: Mac OS X 10.8.2 (12C3104)
Report Version: 10
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000008
VM Regions Near 0x8:
-->
__TEXT 00000001085db000-000000010866a000 [ 572K] r-x/rwx SM=COW /Volumes/VOLUME/*/MyAppName5.18.85b.app/Contents/MacOS/MyAppName
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 ??? 0x0000000000000008 0 + 8
1 com.apple.FinderKit 0x00007fff8aea97ee ApplicationURL(TString const&) + 77
2 com.apple.FinderKit 0x00007fff8aea9a27 AppBundleIDCanOpenExtension(TString const&, TString const&) + 392
3 com.apple.FinderKit 0x00007fff8aeaa245 PreviewCanOpenExtension(TString const&) + 177
4 com.apple.FinderKit 0x00007fff8aeaa55e -[FIFinderViewGutsController finderLocationPopUpWillDisplay:] + 198
5 com.apple.FinderKit 0x00007fff8aed47ff -[FILocationPopUp menuNeedsUpdate:] + 46
6 com.apple.AppKit 0x00007fff89c486a8 -[NSMenu _populateFromDelegateWithEventRef:] + 674
7 com.apple.AppKit 0x00007fff89bece64 -[NSMenu _populateWithEventRef:] + 83
8 com.apple.AppKit 0x00007fff89c476ac -[NSCarbonMenuImpl _carbonPopulateEvent:handlerCallRef:] + 427
9 com.apple.AppKit 0x00007fff89c47245 NSSLMMenuEventHandler + 342
10 com.apple.HIToolbox 0x00007fff8769ff0a DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1206
11 com.apple.HIToolbox 0x00007fff8769f3d9 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 410
12 com.apple.HIToolbox 0x00007fff8769f236 SendEventToEventTargetWithOptions + 43
13 com.apple.HIToolbox 0x00007fff876e8d58 SendMenuPopulate(MenuData*, OpaqueEventTargetRef*, unsigned int, double, unsigned int, OpaqueEventRef*, unsigned char*) + 279
14 com.apple.HIToolbox 0x00007fff87671d5a SendMenuOpening(MenuSelectData*, MenuData*, double, unsigned int, unsigned int, __CFDictionary*, unsigned char, unsigned char*) + 286
15 com.apple.HIToolbox 0x00007fff87806cff PopUpMenuSelectCore(MenuData*, Point, double, Point, unsigned short, unsigned int, Rect const*, unsigned short, unsigned int, Rect const*, Rect const*, __CFString const*, OpaqueMenuRef**, unsigned short*) + 895
16 com.apple.HIToolbox 0x00007fff87806924 _HandlePopUpMenuSelection7 + 629
17 com.apple.AppKit 0x00007fff89cca61b _NSSLMPopUpCarbonMenu3 + 3916
18 com.apple.AppKit 0x00007fff8a02bd2a _NSPopUpCarbonMenu3 + 39
19 com.apple.AppKit 0x00007fff89cc95dc -[NSCarbonMenuImpl popUpMenu:atLocation:width:forView:withSelectedItem:withFont:withFlags:withOptions:] + 346
20 com.apple.AppKit 0x00007fff89e8d315 -[NSPopUpButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 540
21 com.apple.AppKit 0x00007fff89b15c9c -[NSControl mouseDown:] + 820
22 com.apple.AppKit 0x00007fff89b0d60e -[NSWindow sendEvent:] + 6853
23 com.apple.AppKit 0x00007fff89b09744 -[NSApplication sendEvent:] + 5761
24 com.apple.AppKit 0x00007fff89c7276a -[NSApplication _realDoModalLoop:peek:] + 582
25 com.apple.AppKit 0x00007fff89c729ce -[NSApplication runModalForWindow:] + 120
26 com.apple.AppKit 0x00007fff89ebddb6 -[NSSavePanel runModal] + 302
27 com.TopTestDFU 0x00000001085f22fe -[AppController onSaveScriptFileAs:] + 148
28 com.apple.AppKit 0x00007fff89b18a59 -[NSApplication sendAction:to:from:] + 342
29 com.apple.AppKit 0x00007fff89c4e44c -[NSMenuItem _corePerformAction] + 406
30 com.apple.AppKit 0x00007fff89c4e13a -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 133
31 com.apple.AppKit 0x00007fff8993b46f -[NSMenu _internalPerformActionForItemAtIndex:] + 36
32 com.apple.AppKit 0x00007fff8993b2f7 -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 135
33 com.apple.AppKit 0x00007fff89c47245 NSSLMMenuEventHandler + 342
34 com.apple.HIToolbox 0x00007fff8769ff0a DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1206
35 com.apple.HIToolbox 0x00007fff8769f3d9 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 410
36 com.apple.HIToolbox 0x00007fff876b51bd SendEventToEventTarget + 40
37 com.apple.HIToolbox 0x00007fff876ebe89 SendHICommandEvent(unsigned int, HICommand const*, unsigned int, unsigned int, unsigned char, void const*, OpaqueEventTargetRef*, OpaqueEventTargetRef*, OpaqueEventRef**) + 443
38 com.apple.HIToolbox 0x00007fff87690c11 SendMenuCommandWithContextAndModifiers + 59
39 com.apple.HIToolbox 0x00007fff87690bc3 SendMenuItemSelectedEvent + 254
40 com.apple.HIToolbox 0x00007fff87690a4f FinishMenuSelection(SelectionData*, MenuResult*, MenuResult*) + 94
41 com.apple.HIToolbox 0x00007fff8766caab MenuSelectCore(MenuData*, Point, double, unsigned int, OpaqueMenuRef**, unsigned short*) + 605
42 com.apple.HIToolbox 0x00007fff8766c0b8 _HandleMenuSelection2 + 565
43 com.apple.AppKit 0x00007fff89b069c6 _NSHandleCarbonMenuEvent + 245
44 com.apple.AppKit 0x00007fff89a28b7f _DPSNextEvent + 2073
45 com.apple.AppKit 0x00007fff89a27ed2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
46 com.apple.AppKit 0x00007fff89a1f283 -[NSApplication run] + 517
47 com.apple.AppKit 0x00007fff899c3cb6 NSApplicationMain + 869
48 com.TopTestDFU 0x00000001085dc3d4 start + 52
谢谢!