Crash in Swift based SpriteKit project with -O optimisation

Originator:steve_w101
Number:rdar://21108886 Date Originated:26-May-2015 08:45 PM
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 8.3 (12F70)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
Several crashes occur in a Swift based SpriteKit project when touching the screen or pausing the SKScene. They only occur when compiling with "Fastest (-O)" optimization. As documented:-

Simulator (iPhone 5/5s), Debug, Swift Optimization Level None (-Onone) = No crash.
Device (iPhone 5), Debug, Swift Optimization Level None (-Onone) = No crash.
Simulator (iPhone 5), Debug, Swift Optimization Level Fastest (-O) = Crash.
Simulator (iPhone 5s), Debug, Swift Optimization Level Fastest (-O) = Crash.
Device (iPhone 5), Debug, Swift Optimization Level Fastest (-O). = Crash when not connected to the debugger.
Device (iPad Air), Debug, Swift Optimization Level Fastest (-O). No crashes occur regardless of whether or not the debugger is connected.

The stack trace includes internal SpriteKit method calls that indicate the crash occurs when traversing the node hierarchy (such as SKNode nodesAtPoint: and children).

Steps to Reproduce:
1) Download the example project at https://github.com/NxSoftware/Swift-SpriteKit-Crash
2) Run the project in the simulator with -O Swift optimization.
3) Tap anywhere on the screen or attempt to pause the game.

Expected Results:
The game should be paused if that was the desired action, or a touch even should be registered in the SKScene.

Actual Results:
The app crashes.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!