-1

いくつかのファイルをダウンロードするためのディレクトリを作成する必要があるアプリを作成しています。電話すると

[[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 CoreFoundation 0x00007fff862c40a6 __exceptionPreprocess + 198
    1 libobjc.A.dylib 0x00007fff8d4e53f0 objc_exception_throw + 43
    2 CoreFoundation 0x00007fff8635a6ea-[NSObject(NSObject)doesNotRecognizeSelector:] + 186
    3 CoreFoundation 0x00007fff862b25ce ___ forwarding ___ + 414
    4 CoreFoundation 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 tr​​ackMouse:inRect:ofView:untilMouseUp:] + 1855
    10 AppKit 0x00007fff8a91c521-[NSButtonCell tr​​ackMouse:inRect:ofView:untilMouseUp:] + 504
    11 AppKit 0x00007fff8a91bc9c-[NSControl mouseDown:] + 820
    12 AppKit 0x00007fff8a91360e-[NSWindow sendEvent:] + 6853
    13 AppKit 0x00007fff8a90f744-[NSApplication sendEvent:] + 5761
    14 AppKit 0x00007fff8a8252fa-[NSApplication run] + 636
    15 AppKit 0x00007fff8a7c9cb6 NSApplicationMain + 869
    16dArt0x00000001000016b2メイン+34
    17 libdyld.dylib 0x00007fff8b36b7e1 start + 0
)。
4

1 に答える 1

1

My question has been answered elsewhere. I just needed to add the (copy) qualifier to theDownloadLocation property.

Like @property (copy) NSString *theDownloadLocation;

于 2013-02-14T01:27:18.777 に答える