我正在制作一个需要创建目录来下载一些文件的应用程序。当我打电话
[[NSFileManager defaultManager] createDirectoryAtPath:
[[self.searchURL theDownloadLocation] stringByStandardizingPath]
withIntermediateDirectories:YES attributes:nil error:nil];
之内
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
它工作正常。我有一个应该开始下载的按钮。我已经将它放在 xib 文件中,它可以做任何其他事情,所以我知道按钮可以工作。NSFileManager
同样,如果我在 中调用该方法,则目录创建没有问题applicationDidFinishLaunching
,但在我按下按钮时调用的其他方法中则没有。它崩溃并显示一条(lldb)
消息。
传递的参数完全一样,我什NSLog
至[[self.searchURL theDownloadLocation] stringByStandardizingPath]
在按钮方法中加入了,它肯定是一个NSString
,所以当我按下按钮时它会记录。我错过了什么?
我有时会收到一条错误消息:
2013-02-12 19:33:04.404 dArt[2351:303] -[NSISRestrictedToNonNegativeVariableToBeMinimized
stringByStandardizingPath]: unrecognized selector sent to instance 0x100528ba0
2013-02-12 19:33:04.405 dArt[2351:303] -[NSISRestrictedToNonNegativeVariableToBeMinimized
stringByStandardizingPath]: unrecognized selector sent to instance 0x100528ba0
2013-02-12 19:33:04.408 dArt[2351:303] ( 0 核心基础 0x00007fff862c40a6 __exceptionPreprocess + 198 1 libobjc.A.dylib 0x00007fff8d4e53f0 objc_exception_throw + 43 2核心基础0x00007fff8635a6ea-[NSObject(NSObject)不识别选择器:]+186 3 核心基础 0x00007fff862b25ce ___forwarding___ + 414 4 核心基础 0x00007fff862b23b8 _CF_forwarding_prep_0 + 232 5 dArt 0x000000010000248d -[AppDelegate searchTheArt:] + 141 6 AppKit 0x00007fff8a91ea59-[NSApplication sendAction:to:from:] + 342 7 AppKit 0x00007fff8a91e8b7-[NSControl sendAction:to:] + 85 8 AppKit 0x00007fff8a91e7eb-[NSCell_sendActionFrom:] + 138 9 AppKit 0x00007fff8a91ccd3-[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 1855 10 AppKit 0x00007fff8a91c521-[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 504 11 AppKit 0x00007fff8a91bc9c -[NSControl mouseDown:] + 820 12 AppKit 0x00007fff8a91360e-[NSWindow 发送事件:] + 6853 13 AppKit 0x00007fff8a90f744-[NSApplication sendEvent:] + 5761 14 AppKit 0x00007fff8a8252fa -[NSApplication 运行] + 636 15 AppKit 0x00007fff8a7c9cb6 NSApplicationMain + 869 16 dArt 0x00000001000016b2 主要 + 34 17 libdyld.dylib 0x00007fff8b36b7e1 开始 + 0 )