Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/97.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ios:泄漏警告不清楚_Ios_Path_Memory Leaks - Fatal编程技术网

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];
 }