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 7504817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:41:57+00:00 2026-05-29T21:41:57+00:00

In my app when I am switching views, after about the 4th time I

  • 0

In my app when I am switching views, after about the 4th time I switch views I get a crash that says:

*** -[CALayer retain]: message sent to deallocated instance 0x6c4ba0

I have NSZombieEnabled in Xcode and it points me to this line whenever it switches views:

[self.view removeFromSuperview];

Also if I do a backtrace of the (gdb) it gives me this:

#0  0x37dd68a0 in ___forwarding___ ()
#1  0x37d31680 in __forwarding_prep_0___ ()
#2  0x37d1d026 in CFRetain ()
#3  0x37d26bb2 in +[__NSArrayI __new::] ()
#4  0x37d26acc in -[__NSPlaceholderArray initWithObjects:count:] ()
#5  0x3518e680 in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] ()
#6  0x3518e7a4 in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] ()
#7  0x3534c40c in __UIViewWillBeRemovedFromSuperview ()
#8  0x3518dad0 in -[UIView(Hierarchy) removeFromSuperview] ()
#9  0x000368a6 in __block_global_1 (.block_descriptor=<value temporarily unavailable, due to optimizations>, finished=1 '\001') at /Users/bobsComputer/Desktop/Projects/NewApp/MyApp/MyApp3/MyApp3ViewController.mm:135
#10 0x351a70be in -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] ()
#11 0x351a181a in -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] ()
#12 0x351a6fb8 in -[UIViewAnimationState animationDidStop:finished:] ()
#13 0x3354fba6 in CA::Layer::run_animation_callbacks ()
#14 0x37a91f7a in _dispatch_main_queue_callback_4CF$VARIANT$mp ()
#15 0x37da72dc in __CFRunLoopRun ()
#16 0x37d2a4dc in CFRunLoopRunSpecific ()
#17 0x37d2a3a4 in CFRunLoopRunInMode ()
#18 0x378a8fcc in GSEventRunModal ()
#19 0x351ba742 in UIApplicationMain ()

Also this how I switch views, I have a main view controller. I then use a ParentView and protocols to call these methods from my other views controllers. I then use custom UIView animations to switch views.

Does anyone have any ideas why this is crashing?

Thanks!

  • 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-29T21:41:59+00:00Added an answer on May 29, 2026 at 9:41 pm

    -[UIView addSubview:] causes the subview to be retained, and -[UIView removeFromSuperview] causes the view to be released. This is direct from Apple’s UIView documentation. At that point, one of your objects needs to retain the CALayer or it will be deallocated.

    I assumed that the CALayer was created by you directly. All UIViews are associated with CALayers; the CALayer is what a UIView draws into, and then its CALayer is composited onto the screen. If you’re not working with CALayers directly, this is a symptom of another problem.

    The core problem you’re describing is an overrelease. It’s possible you’re not retaining a UIView when you should. I suggest you run the Xcode analyzer (in Xcode 4, choose the Product > Analyze) menu item and see what gets reported. Pay special attention to all of the memory management errors it reports.

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

Sidebar

Related Questions

I've an android app that has multiple views. I've disabled the automatic orientation switching
In order to switch between views in my iOS app, I have been using
In my app when I am switching views with an animation using UIView animations,
I'm having trouble switching views with button presses in my Android app. The code
In my app I want to add a custom transition when switching views. Since
I'm working on an app in which I want the viewstack to switch views
In my app when I am switching views with an animation using UIView animations,
I'm trying to write a faster user switching app for Windows. Win+L and selecting
I'm updating a Java Swing application to support the user switching the app's font
Is DirectSound the best audio abstraction layer for Windows? Switching my app from a

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.