UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: Day 95 / Project 29 - "could not create physics body"

Forums > 100 Days of Swift

I've encountered this issue on previous SpriteKit projects but I'm running into it again on Project 29. I've double checked the code and it's all exactly as it should be as far as I can tell. I'm at the part where we first write the code for launching the bananas. Paul shows how at this point, the banana will launch and bounce off the buildings and players. But when I launch the simulator (iPad Air 3rd Gen), my banana will just pass straight through the buildings. In the console there's a bunch of errors showing "PhysicsBody: Could not create physics body." Like I said, I double and triple checked the correct physics bodies are being set to the correct collisionBitMask. Is this maybe a bug with the simulator? Like I said, I've encountered this on some previous projects too that basically rendered the games useless. I don't have a physical iPad I can test this on either. Anyone have any tips on fixing this?


Well that's interesting. My version recompiled under Xcode 11.4 is broken. The Console displays multiple lines of

2020-04-12 16:16:02.470854+0800 P29ExplMonkeys[25596:2784817] SKView: ignoreRenderSyncInLayoutSubviews is NO. Call _renderSynchronouslyForTime without handler

and subsequent banana hits on the building in exactly the same place does not result in any further errosion of the building surface. It appears that it is not storing the change.



Aha, the solution is to change your target iOS build to 12.x and select a version of the iPad Air 3rd generation that is running an earlier verseion of iOS. If you don't have a simulator listed in the drop down list of simulators for an iPad Air 3rd gen running iOS 12.x then you can create one from the options at the bottom of that list. "Add Additional Simulators"


That fixed it! Although it begs the question, how do you get it to work on iOS 13, but this is satisfactory enough for now. Thanks!


Hacking with Swift is sponsored by Superwall

SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.

Learn More

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.