• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: iOS 9: Adding CALayer to self.view.layer causes EXC_BAD_ACCESS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iOS 9: Adding CALayer to self.view.layer causes EXC_BAD_ACCESS


  • Subject: Re: iOS 9: Adding CALayer to self.view.layer causes EXC_BAD_ACCESS
  • From: Carl Hoefs <email@hidden>
  • Date: Tue, 06 Dec 2016 13:33:11 -0700

> On Dec 6, 2016, at 1:24 PM, David Duncan <email@hidden> wrote:
>
> Your safest bets are to either clear the delegate of the layer at an appropriate time (possibly in your view controller’s dealloc is all that is necessary), or to use a UIView instead of a raw CALayer in this case. Removing the layer would also suffice, as that would prevent UIKit from seeing it at the time in question. Making the layer weak is probably causing your reference to deallocate before it can be added to the layer tree, which is why it doesn’t display in that case.

Thanks for this explanation, David!

I've verified that using either of:
    [self.layer setDelegate:nil];
or
    [self.layer removeFromSuperlayer];
will prevent the crash. It's just a bit
surprising to me that this is needed...

-Carl


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: iOS 9: Adding CALayer to self.view.layer causes EXC_BAD_ACCESS
      • From: Carl Hoefs <email@hidden>
References: 
 >iOS 9: Adding CALayer to self.view.layer causes EXC_BAD_ACCESS (From: Carl Hoefs <email@hidden>)
 >Re: iOS 9: Adding CALayer to self.view.layer causes EXC_BAD_ACCESS (From: David Duncan <email@hidden>)

  • Prev by Date: Re: Drag UITableView up/down
  • Next by Date: Re: Drag UITableView up/down
  • Previous by thread: Re: iOS 9: Adding CALayer to self.view.layer causes EXC_BAD_ACCESS
  • Next by thread: Re: iOS 9: Adding CALayer to self.view.layer causes EXC_BAD_ACCESS
  • Index(es):
    • Date
    • Thread