Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3613972
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:11:26+00:00 2026-05-18T22:11:26+00:00

I just tracked down a crash I was having in my iOS app and

  • 0

I just tracked down a crash I was having in my iOS app and it is related to willAnimateRotationToInterfaceOrientation being called before viewWillAppear.

I have an app with two views. Basically, when view1 disappears, I release some arrays, assuming they will be re-initialized when it re-appears in viewWillAppear.

However, if I change orientation in view2 then switch back to view1, this causes willAnimateRotationToInterfaceOrientation to happen before view1 has calledviewWillAppear and re-initialized everything and this causes a crash.

Is there any way to delay willAnimateRotationToInterfaceOrientation until after the view has appeared and everything has been re-initialized?

If not, the only solutions I can see are either not using willAnimateRotationToInterfaceOrientation (which results in an ugly looking orientation change) or not releasing my data when I switch from view1 to view2 which results in more memory being used than necessary.

Does anybody have any thoughts on what I should do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:11:26+00:00Added an answer on May 18, 2026 at 10:11 pm

    You can use lazy-loading style code avoid your problem, like:

    NSArray* someData;
    
    
    -(void)somefun1{
    
       if (!someData) {
    
          [self loadData];
       }
    
        //use your data
    }
    
    -(void)somefun2{
    
        if (!someData) {
    
        [self loadData];
        }
    
        //use your data
    
    }
    
    -(void)loadData{
        //some loading code
    }
    

    use lazy-loading style code you never need mind event calling order.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a multithreaded Java application, I just tracked down a strange-looking bug, realizing that
I just tracked down a problem where I had to close all open filehandles
I just now tracked down a bug in my code to the fact that
Just checking my JS and I have an error, but I cannot see where.
Just a knowledge question which I would like to ask: For example, I have
I've tracked down an error in my logs, and am trying to reproduce it.
I just spent a day tracking down a really weird bug. It was a
I think I tracked down a memory leak and want to confirm what I
I'm just getting started with the factory_boy django library for test factories, and having
I am just attempting to concatenate two strings in C and I don't know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.