ios:泄漏警告不清楚
我有以下两种方法:ios:泄漏警告不清楚,ios,path,memory-leaks,Ios,Path,Memory Leaks,我有以下两种方法: -(void)playSound { NSString* filePath = [self getBasePath]; // <-- warnings appear when this is called } 这意味着什么?您可能不是在主线程上执行此方法。如果这样做,则必须创建一个NSAutoreleasePool -(void)playSound { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc
-(void)playSound {
NSString* filePath = [self getBasePath]; // <-- warnings appear when this is called
}
这意味着什么?您可能不是在主线程上执行此方法。如果这样做,则必须创建一个NSAutoreleasePool
-(void)playSound {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int index = rand() % [soundFilenames count];
NSString* filePath = [self getBasePath];
[pool drain];
}
可能您不是在主线程上执行此方法。如果这样做,则必须创建一个NSAutoreleasePool
-(void)playSound {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int index = rand() % [soundFilenames count];
NSString* filePath = [self getBasePath];
[pool drain];
}
谢谢,事实就是这样。谢谢,事实就是这样。
-(void)playSound {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int index = rand() % [soundFilenames count];
NSString* filePath = [self getBasePath];
[pool drain];
}