Note that there are some explanatory texts on larger screens.

plurals
  1. POMy iPhone app crashes after returning from background. Cause: UIImage problem
    text
    copied!<p>First off, I want to say this site is AWESOME! and it helped me do lots of stuff while creating my iPhone app.</p> <p>Now, my problem is:</p> <p>When I launch my app, I have a UIImageView that loads an image depending on an if/else statements in</p> <p><code>-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event</code></p> <p>method. These images are assigned as follows:</p> <pre><code>BG.image = someImage; </code></pre> <p>of course, BG is the UIImageView, and someImage is an iVar with @property, @synthesis. someImage is initialized with an image from the main bundle in viewDidLoad:</p> <pre><code>- (void)viewDidLoad { //init stuff from file someImage = [UIImage imageNamed:@"FirstViewBG_5N.png"]; [super viewDidLoad];} </code></pre> <p>My app runs happily, loading images according to touchBegan (as mentioned), BUT!</p> <p>When my app is sent to background and comes back, it crashes upon first touch. </p> <p>When I replaced:</p> <pre><code>BG.image = someImage </code></pre> <p>with:</p> <pre><code>BG.image = [UIImage imageNamed:@"FirstViewBG_5N.png"]; </code></pre> <p>it runs happily?! I think the someImage is flushed or corrupts?</p> <p>I don't want to leave it like this because imageNamed method reads from disk every time, which will cause performance problems, i think?</p> <p>I think my question is clear? It is that:</p> <p>1- Why will my app crash after returning from backgroud 2- How do I solve this?</p> <p>All your help is appreciated! Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload