我有以下方法,它将文件名作为字符串接收,然后将其附加到在方法之外声明的路径。
-(BOOL)deleteFile:(NSString *)filename{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *myPathDocs = [documentsDirectory stringByAppendingPathComponent:filename];
NSLog(@"[deleteFile] *myPathsDocs: %@", myPathDocs);
NSLog(@"[deleteFile] about to delete file");
//delete file
BOOL success = [fileManager removeItemAtPath:myPathDocs error:NULL];
NSLog(@"[deleteFile] success? %@", success);
return success;
它从目录中删除文件,但随后程序崩溃而没有返回,甚至没有返回
NSLog(@"[deleteFile] success? %@", success);
有任何想法吗?我认为这可能很明显,我只是没有看到,但我已经看过很多次了,一切似乎都井井有条。