Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

01.vipin

macrumors newbie
Original poster
Feb 22, 2011
16
0
I am developing a small game app using Uikit + Uiimages. In the normal condition my app is running without any problem . but when i use rashly it will crash with the error

<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).

I am relesing all the image views and videos after usage. I tested my app with leak tool. There is no leaks also. No warnings, no potential leaks etc...

I searched for a good answer, but i didn't get the appropriate answer yet. Anyone knows the answer , please reply. I posted some of the codes below.


Code:
- (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
{

[self.view addSubview:[self.presentView playerPrepare]];

}
-(void)wakeUPPanjo
{
NSString *url = [[NSBundle mainBundle] pathForResource:@"01_Anim" 
ofType:@"mp4"];

NSURL *movieURL = [NSURL fileURLWithPath:url];



self.presentView.player = [[MPMoviePlayerController alloc] 
initWithContentURL:movieURL];




[[NSNotificationCenter defaultCenter] 
addObserver:self
selector:@selector(movieFinishedCallback 
name:MPMoviePlayerPlaybackDidFinishNotification
object:self.presentView.player];

[self.presentView.player prepareToPlay];

[self performSelector:@selector(playerPrepare) withObject:nil afterDelay:0.5];

wakeUpTimer = nil;


}


-(void)viewLoad
{

wakeUpTimer = [NSTimer scheduledTimerWithTimeInterval:videoDelay target:self selector:@selector(wakeUPPanjo) userInfo:nil repeats:NO];

[self performSelector:@selector(flowerImagesAnimate) withObject:nil afterDelay:flowerPopupDelay];
}

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.

[self performSelectorOnMainThread:@selector(viewLoad) 
withObject:nil 
waitUntilDone:false];
}
 
Last edited by a moderator:
The only thing I notice is the you are not releasing self.flowerImage, so the opening to those files are still open, adding to your open file count.

A side note; I wonder why you call viewLoad from viewDidLoad. I don't see any benefit to that.
 
The only thing I notice is the you are not releasing self.flowerImage, so the opening to those files are still open, adding to your open file count.

A side note; I wonder why you call viewLoad from viewDidLoad. I don't see any benefit to that.

I have release the self.flower image in dealloc . Sorry i didn't put that code here.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.