这是我的问题的背景。首先有一个线程开始:
-(void)run_thread: (NSObject* )file_path_NSObject
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *local_recordFilePath_NSString = (NSString *)file_path_NSObject;
NSLog(@"run thread : path %@ ", local_recordFilePath_NSString);
printf("Running Thread...\n");
runAllAudioRoutines(local_recordFilePath_NSString);
// more code....
上面的所有内容都正确打印到控制台。然后是被调用的方法:
void runAllAudioRoutines(NSString *file)
{
NSLog(@"running All Audio Routines method...\n");
NSString *truncatedFilePath = [file stringByReplacingOccurrencesOfString:@"LoopExtended.wav"
withString:@"recordedFile.wav"];
NSLog(@"FILE for !!!! --> %@",truncatedFilePath);
const char *location = [truncatedFilePath UTF8String];
const char *write_location = [file UTF8String];
int *vocal_data = read_wav(location, &size_vocal);
// more code....
奇怪的是根本没有NSLogs 打印。没有。纳达。压缩。然后应用程序在尝试将位置传递给 read wav 方法时崩溃(可能是因为字符串有问题)。
当我从使用 NSTemporaryDirectory 切换到 NSBundle 时,这一切都开始发生了,但我不确定这是否与它有关。有什么建议吗?
我接受了 Joetjah 的建议并开始使用:
[self runAllAudioRoutines:local_recordFilePath_NSString];
-(void)runAllAudioRoutines:(NSString*) file
现在我明白了:
第二次运行,来自 Joetjah 的第二次建议