English 中文(简体)
X 代码坠毁水平=1+2,无潜在泄漏(可能是由于im升)
原标题:Xcode crash level=1 + 2 without potential leaks (maybe because of animation)

First of all i am a n00b. After long time of trying and research i decided to get some external help. My Project: i made a book for children. After i analyzed the code I got rid of all potential leaks, but still i have a Level=1+2 crash. with testing my app i figured out that my animations could be the probleme because after flipping through the book and watching around 30 animations it crashes.
Did i forget to release something? maybe you see something i don´t see. Here is my Code

- (void)addButton1 {
    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom]; 
    [button1 setFrame:CGRectMake(174, 100, 421, 250)];
    [button1 setBackgroundImage:[UIImage imageNamed:@"button.png"] 
                   forState:UIControlStateNormal];
    [button1 addTarget:self action:@selector(buttonPressed1)
      forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button1];
}

- (void)animieren1:(UIImageView *)image {
    [self animationZustand1];
    [UIView commitAnimations];  
}

- (void)buttonPressed1 {
    [self animieren1:self.animation1];
}


- (void)normalZustand2 {
    [self.animation2 setImage:[UIImage imageNamed:@"muller3s.png"]];
}

- (void)initAnimation2 {
    animation2 = [[UIImageView alloc] initWithFrame:
                   CGRectMake(173, 550, 422, 262)];
    [self normalZustand2];
    self.animation2.opaque = YES;
    [self.view addSubview:self.animation2];
}   

- (void)animationZustand2 {
    NSArray *imageArray = [[NSArray alloc] initWithObjects:
                       [UIImage imageNamed:@"muller3s.png"],
                       [UIImage imageNamed:@"muller4s.png"],
                       nil];    
    self.animation2.animationImages = imageArray;
    self.animation2.animationDuration = 2.1;
    animation2.animationRepeatCount = 1;
    [self.animation2 startAnimating];
    [self normalZustand2];
     [imageArray release];

    NSString *path = [[NSBundle mainBundle] pathForResource:@"riesel" ofType:@"mp3"];
    AVAudioPlayer* theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL   
    fileURLWithPath:path] error:NULL];
    theAudio.volume = 0.1;
    self.audioPlayer3 = theAudio;
    [theAudio play];
    [theAudio release];
}       

Any ideas? It would be really cool if anyone could help me! Thanks in advance Planky

最佳回答

各位不明白1级坠毁究竟是什么。 数额指的是记忆警告——在你接近用尽记忆分配时,你的申请从系统收到通知。

你应对这些通知做出回应,清除其不再使用的物体,如果你不,你会收到更多的警告,直到你被系统终止,因为没有给你更多的记忆。

Whilst memory warnings can be caused be leaks, this is typically not the root problem. In the overwhelming number of cases they are instead caused by trying to load too many raw assets into memory at the same time.

You will need to take a hard look at your code and structure to figure out the best way to cope with this. Perhaps currently you re just loading all 30 pages of your book into memory at the same time: you need to think about loading in resources as they are needed. If an asset isn t visible to the user, perhaps you could remove it from memory and reload it when needed.

在图形丰富的图象中,还必须记住文件尺寸doesn par。 图像的大小在记忆中。 附录一 记忆中填满时,这一形象将超过3兆字节的记忆。 所有SOS装置的记忆都受到限制,比其他设备更是:在一代人中,单一图像可能占你的记忆总分配的5%(贵方的照片可达到不同程度,取决于许多因素:因此,在你接近极限时,你收到通知的原因)。

Memory warnings are one of the more friendly crashes, because iOS will try to tell warn your app before they happen. So it s very important you listen out for these notifications in your controllers, and respond accordingly.

问题回答

暂无回答




相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签