ViktorEvil, your solution is correct. The problem you're getting an error is that you are initializing the Trail.scn file inside createTrail(color:geometry:) which is called inside spawnShape() which is called inside renderer(_:updateAtTime:), which causes your console to print the following:
[SceneKit] Error: Scene <SCNScene: 0x2803f5500> is modified within a rendering callback of another scene (<SCNScene: 0x2803e0000>). This is not allowed and may lead to crash
The solution to fix this is to initialize the SCNScene for the trail outside createTrail(color:geometry:).
I got the hint from this StackOverflow answer - https://stackoverflow.com/a/52792424/10654098.
So you need to declare a new variable in GameViewController:
var trailScene: SCNScene!
Then, create a function:
func setupTrailScene() {
		trailScene = SCNScene(named: "Trail.scn")!
}
Then call this function in viewDidLoad(). Then modify your createTrail(color:geometry:) to use the instance variable trailScene instead of declaring the constant inside:
func createTrail(color: UIColor, geometry: SCNGeometry) -> SCNParticleSystem {
		 let node: SCNNode = (trailScene.rootNode.childNode(withName: "Trail", recursively: true)!)!
		 let particleSystem: SCNParticleSystem = (node.particleSystems?.first)!
		 particleSystem.particleColor = color
		 particleSystem.emitterShape = geometry
		 return particleSystem
}
I think this is the best workaround so far, which is to create a particle system node inside a .scn file and get the particle system from that node.
Post
Replies
Boosts
Views
Activity
I was able to view my crash logs in Xcode by downloading them from App Store Connect then right-click the .crash file and choose Open With > Xcode.
After that the same behavior as clicking the Open in Project button from Xcode organizer; It will ask me which project to open and then I can view the crash report and trace it in code.
This is just a workaround. I hope this original issue is fixed so that the same crashes in App Store Connect > TestFlight > Crashes appear inside Xcode > Organizer > Crashes.
I'm also facing this issue in iOS 14.2.
Here's a simple example that is causing Buttons to not be tappable when edit mode is on:
struct ContentView: View {
		let items = ["A", "B", "C"]
		@State private var selectedItem: String?
		var body: some View {
				List(selection: $selectedItem) {
						Section(header: Text("Select an Item")) {
								ForEach(items, id: \.self) { item in
										Text(item)
								}
						}
						Button("Next") {
								print("You selected: \(selectedItem)")
						}
				}
				.listStyle(InsetGroupedListStyle())
				.environment(\.editMode, .constant(.active))
		}
}
Trying to tap on the button will not print the string to on the console. As soon as I set the edit mode to .constant(.inactive), the button is tappable again and the print works.
I have tried replacing the the button with the following:
Button("Next", action: {})
		.onTapGesture {
				print("You selected: \(selectedItem)")
		}
But this hack only triggers the tap if it is exactly on the button text. Any tap in the remaining area of the list row will not trigger the onTapGesture. I'm not sure if this is an incorrect implementation of single selection lists on my side or if it's a bug in SwiftUI.
I'm facing this issue in Xcode 11.7
I see that you force unwrapped response. Is the respose part of the data task completion block guarenteed to have a value? If yes, why is it optional in the first place?Thank you very much if you answer this, because I couldn't find a good explanation for it.