Custom CALayer with properties crashes on iOS 9 devices

Hello,


The new Xcode 11.4 seems to create a problem when programmatically creating custom CALayer objects containing some properties. To see this problem, Create an extension of an CALayer:


class CustomLayer: CALayer {
   var someProperty: CGFloat = 0
}


Now programmatically create such a layer, e.g. in a viewDidLoad


let customLayer = CustomLayer()


Compile and run this on a iOS 9 device (my tests were with an iPhone 4S with iOS 9.3.6). The device crashes when initializing the layer. It is deallocated BEFORE it can actually set the property on the customLayer. Enable zombies for a more detailed stack trace.


Is there a workaround for this problem? Will there be fix?


Compiling the same code with an older Xcode e.g. 13.1 does not crash the iOS 9 device.


We cannot upgrade to the new Xcode since our app is designed for iOS 9+.

You should file a bug about this. Please post your bug number, just for the record.

If you’d like help searching for a workaround, open a DTS tech support incident and talk to our Tools Guy™.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks Eskimo,


I filed a bug report about it. The bug number is FB7664233. Now awaiting response.


Note: Xcode 11.4.1 was released yesterday. Unfortunately, this new Xcode does not fix the reported crash.

Thanks for addressing this RudyB! I made a similar post as well, but you've narrowed down the problem significantly. Looking forward to hearing about the response.

Is there any progress?

Have you tried this with Xcode 11.5? I’m not 100% sure that it will fix this problem — looking at the bug, there seems to be a bunch of inter-related issues in play — but it’s certainly possible.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hi i had same issue and followed this thread, with xCode 11.3 there is no issue (running on iPad 2 iOS 9.3.3), in xCode 11.4 crash and also in xCode 11.5 😟 so we are forced to drop support for iOS 9.X

Also having this issue in iOS9, Xcode 11.5.


Preventing updates for iOS9.

I can also confirm that Xcode 11.5 does NOT fix the problem.


The response I got from my feedback is:


Recent Similar Reports: Less than 10

Resolution: Potential fix identified - For a future OS update


So that sounds like they might fix it in a future iOS 9 release? Really hoping that the next Xcode will fix the problem...

So that sounds like they might fix it in a future iOS 9 release?

I’m sorry to say that FBA is misleading you here. This is an Xcode regression and it’s very likely that any fix will ship as part of an Xcode update rather than an iOS update.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Does anyone here know whether Xcode 11.6 will fix the issue? The beta release notes only state: "There are no release notes for this software update."

FYI it has been confirmed that Xcode 11.6 does not fix the issue
I just tested with the latest version of xcode 11.6 Beta, there is always the same crash.
Xcode 12 beta is out, did anyone have chance to test if this issue still occurs?
I finded it doesn't crashed in Objective-C code App, but crashed in Swift and Objective-C mixed App, is this issue matter of Swift ?
The history of this bug is long and complicated. If I’m following the chain of duplicates correctly, the underlying bug (r. 61841582) is still not fixed.

To confirm this I dusted off my iOS 9 test device and ran RudyB’s test code on it. It still crashes in the same way.

Sorry folks )-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Custom CALayer with properties crashes on iOS 9 devices
 
 
Q