我的代码看起来像这样,有时应用程序在尝试记录错误时会在最后一行崩溃。我究竟做错了什么?
BOOL isDir;
NSError *error;
NSString *downloadPath = [[NSString stringWithFormat:@"%@/%@", [download downloadFolder], [download escapedTitle]] stringByExpandingTildeInPath];
NSFileManager *fileManager = [NSFileManager defaultManager];
if (![fileManager fileExistsAtPath:downloadPath isDirectory:&isDir])
{
[fileManager createDirectoryAtPath:downloadPath withIntermediateDirectories:YES attributes:nil error:&error];
if (error)
NSLog(@"%@", [error localizedDescription]);
}
我还附上了控制台的输出: