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

  • SEARCH
  • Home
  • 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 7961883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:10:32+00:00 2026-06-04T05:10:32+00:00

I am experiencing my application hangs when the user taps the home button: The

  • 0

I am experiencing my application hangs when the user taps the home button:
The snippet causing the problem is this:

[UIView animateWithDuration:0.5
                      delay: (float)random()/RAND_MAX * 1.0f
                    options: UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat
                 animations:^{
                     [self setAlpha:1.0f];
                 }
                 completion:^(BOOL finished){
                 }];

I believe what is happening is that the random delay schedules the animation, the user then quits – so the method that removes the animation (it is set to autorepeat) is never called? and the app hangs, while still showing the animation.

It is so bad that a restart of the iPhone is needed. I had similar issues with blocks and animations before so this was the first code I out-commented and the problem went away.

I have tried calling [self.layer remove allAnimations] on the view upon tapping the home button, but it does not help.

I have not been successful debugging the issue as it happens in “no-mans-land” after applicationWillEnterbackground has been called. Instruments shows nothing out of the ordinary.

Can someone offer help regarding what approach I should take to make sure animations with delays does not cause this behavior?

(it might be performSelector: withDelay behind the scenes):

  • 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-06-04T05:10:33+00:00Added an answer on June 4, 2026 at 5:10 am

    Sending a removeAllAnimations call to the view’s layer should remove the animation.

    You said “I have tried calling [self.layer remove allAnimations] on the view upon tapping the home button, but it does not help.”

    You would not call self on the view, you would send that message to the view’s layer yourself.

    From the view controller, the code might look something like this:

    [myAnimatedView.layer removeAllAnimations];
    

    BTW, where does the code that you posted reside? It would need be run from an instance method of the view that you are animating in order to work.

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

Sidebar

Related Questions

im experiencing this problem when deploying my django application to heroku , it says
I am experiencing a problem where Rational Application Developer 8 consistently hangs indefinitely on
I am experiencing a strange behaviour of my application in Chrome browser (No problem
Hello Everyone, I am experiencing a strange problem when deploying a Rails 3.1 application
I am experiencing problem in my application with OutOfMemoryException. My application can search for
I'm experiencing a problem with a Classic ASP application I'm maintaining (the architect is
I'm trying to use ProGuard to obfuscate a Java application. I'm experiencing a problem
I'm experiencing a problem with my VBA application. I need to define a Recordset
I'm experiencing a very odd problem with a Java application running under Tomcat. We
Porting MSSQL Application to Sybase (ASE 15.0), and experiencing a problem when I call

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.