小编Vip*_*jay的帖子

自动释放两次对象

NSString *str = [[[[NSString alloc]init]autorelease]autorelease];
str = @"hii";
NSLog(@"%@",str);      
Run Code Online (Sandbox Code Playgroud)

任何人都可以帮我讲述这段代码.将对象自动释放两次将发生的事情.当我运行代码时,我没有得到任何僵尸.为什么呢.

iphone autorelease nsautoreleasepool ipad

7
推荐指数
1
解决办法
5566
查看次数

AVAudioPlayer在IOS 5中无法正常工作

在IOS 4.3中正常工作的音频播放器代码在IOS 5中不起作用.

在模拟器中工作正常,但设备没有声音.有时声音可以听到一段时间,几秒钟后声音就会停止.

没有发现错误.这是IOS 5的问题.

iphone avaudioplayer ipad ios5

2
推荐指数
1
解决办法
1662
查看次数

ImageIO:CGImageRead_mapData'open'失败错误= 24(打开文件太多)

我正在开发一个小型游戏应用程序Uikit + Uiimages.在正常情况下我的应用程序运行没有任何问题.但是当我轻率地使用时,它会因错误而崩溃

<Notice>: ImageIO: CGImageRead_mapData 'open' failed '/var/mobile/Applications/01E69C96-CF79-466F-93AB-3A6752AF1295/PictureBook.app/NextPage.png'

<Notice>: error = 24 (Too many open files).
Run Code Online (Sandbox Code Playgroud)

我将在使用完成后发布所有图像视图和视频.我用泄漏工具测试了我的应用程序.也没有泄漏.没有警告,没有潜在的泄漏等......

我搜索了一个很好的答案,但我还没有得到适当的答案.谁知道答案,请回复.我在下面发布了一些代码.

- (NSMutableArray *)flowerArray {

if (!_flowerArray) {

_flowerArray = [[NSMutableArray alloc]init];

for (int i = 1; i <= 5; i++) {

UIImage *flowerIm = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"01_Flower_0%d.png",i] ofType:nil]];

[_flowerArray addObject:flowerIm];

[flowerIm release];

}

}

return _flowerArray;
}


-(void)flowerImagesAnimate {

self.flowerImage.animationImages = self.flowerArray;

self.flowerArray = nil;

self.flowerImage.animationDuration = 1.0;

self.flowerImage.animationRepeatCount = 3;

[self.flowerImage startAnimating];

}



-(void)playerPrepare
{ …
Run Code Online (Sandbox Code Playgroud)

memory iphone ipad ios

0
推荐指数
2
解决办法
4597
查看次数