Chapter 15 - iPhone X and Core Motion display issues

Hi All,

I’m in Chapter 15 at the moment ( the end of page 440 ), coding-wise there don’t appear to be any problems ( at least nothing is flagging up ) but when it comes to running the code on my device it just doesn’t work. In the simulator, using the iPhone 8 plus, everything looks good. The loading screen is right, the marine and bomb are both fine too. So, it’s looking pretty good. Obviously, the core motion part doesn’t work so as soon as the game starts the marine disappears but I don’t think that’s entirely unexpected.
Problems occur once I try and run the game on my iPhone X. The loading screen doesn’t fit on the screen and when the game actually starts the marine is offset from the bomb and flickers something chronic. Both the bomb marine just disappear too. You can see what it looks like here: Drop Charge Flickering
I’ve got no clue on how to fix this and the other chapters are going to be pretty pointless without being able to run this on a device, so, does anybody have any idea on how to get this working?

@skyrocketsw Can you please help with this when you get a chance? Thank you - much appreciated! :]

The flickering and disappearing sprites may be a z-position issue.

Unfortunately I don’t have an iPhone X to troubleshoot this for you. Have you tried running the final project on your device?

OK, so, the code provided for chapter 17 seems to work just fine. Both the starter and final projects build and run ok. The code for chapter 16 won’t build, both the starter and final chapters fail with the message:

dyld: Library not loaded: @rpath/libswiftAVFoundation.dylib
  Referenced from: /var/containers/Bundle/Application/E0F71F74-67A2-437B-990F-62162008F7E4/
  Reason: image not found

and the code for chapter 15 won’t open at all. All the projects throw the error:

Project /Users/richard/Downloads/2D_Apple_Games_by_Tutorials_3.0_source/15-making-drop-charge/challenge3/DropCharge/DropCharge.xcodeproj cannot be opened because the project file cannot be parsed.

It would be good to have working code for chapters 15 and 16 to be able to check everything is right.

I doubled checked all the z-positions and they’re all good ( according to the book anyway ). Once I removed the Core Motion changes everything worked as expected. The player is solid, the bomb is dropped and the player zooms off the screen. Sometimes, depending on the layout, the player comes back and everything is definitely working as it should. Putting the Core Motion changes back in breaks everything. The player is no longer centred and he flickers something awful. It does look like there’s something wrong in the way that Core Motion is being set up but I have no idea where to start looking at that.

This topic was automatically closed after 166 days. New replies are no longer allowed.