Object Rotation Issue on iOS 9.3.2

Can you try turning off things to see what’s going on? Disable plugins one at a time.

Delete the app from your test device before re-installing to make sure you’re starting with a clean DocumentsDirectory each time. I’ve seen it too often where your saving something and it’s working fine. You made a change and as long as what you have saved is there, you’re fine, but the moment a new person tries it a bug shows up because it can’t find something in DocumentsDirectory or some “first time startup” code is buggy.

Rob

Hi Rob,

I tried to disable plugins one at a time and in the end the app is still really slow and buggy.

I’m testing it on Xcode right now as I don’t have a device with me with iOS9.3 installed on. Do you know if Xcode save anything from older version of your app?

What I also thought is that I built the app first for iOS 9.2 and send that version to Apple, and then I updated Xcode to 7.3.1 and built the second version for iOS9.3 and Apple rejected the app saying that It had the same problem as the 1st version.

Do you think that is there any trace of the 1st version in this one? Apart from changing the Provisioning Profile I don’t know what I can do. Maybe just reinstall all the software?

thanks

Unless you explicitly delete the app from the device, you will retain your sandbox files (system.DocumentsDirectory, system.CachesDirectory and system.TemporaryDirectory). The Xcode simulator will also probably retain them, though if you kill the Xcode simulator between runs (making it boot up fresh each time), it might clear the app completely.

Upgrading to Xcode 7.3 and using iOS 9.3 from our build menu should not cause any issues with previous builds on 9.2.

You could also use Apple’s TestFlight testing service. Upload your build to iTunes Connect, setup one of you physical devices as an TestFlight tester (you will have to Google how to do this, it’s not a Corona specific thing). Completely erase your app from the device and install it from TestFlight. The TestFlight one will use the same provisioning profile that you use to submit the app to the store, so you will be able to test as close to what Apple’s testers are. Then you can tether your phone to your USB port and use Xcode Devices’s to watch the console log and see if anything odd shows up.

Rob

I think I found what’s causing the problem because when I remove some objects I see the app is running smoothly on the Xcode simulator.

Basically I have two rotating blades in my app. They are rotating all the time during the game but they don’t show on the the menu screen (first screen of the app).

They work perfectly in older version of iOS and in the Corona Simulator, but not in iOS 9.3

This is the code for them:

local blade2 = display.newImageRect(group, "IMG/blade.png", 70, 70); blade2.x = pipeBottomPiece.x; blade2.y = pipeBottomPiece.contentBounds.yMin; local blade1 = display.newImageRect(group, "IMG/blade.png", 70, 70); blade1.x = pipeTopPiece.x; blade1.y = pipeTopPiece.contentBounds.yMax; function animate ( event ) blade1.rotation = blade1.rotation + 15 blade2.rotation = blade2.rotation + 15 end Runtime:addEventListener ( "enterFrame", animate );

Do you know if anything has changed with this iOS regrading rotating objects? or they are not coded in the proper way maybe.

I would like to keep them in the final version.

Let me know if you have any ideas about it.

Can you download the latest public build 2830 and try running your app there and see if you still see the lag? I’m trying to determine if this is a regression issue in something we’ve done. I can’t imagine that iOS 9.3 would be the problem.

Thanks

Rob

So I tried to build the app with the latest public build 2830 and the same problem happens in iOS 9.3.

I also tried to put the code related to the blades in one of those plugin sample (the applovin one), just to make sure that It wasn’t just in my app and the same thing happens also there.

The blades are rotating at a very good speed in the Corona Simulator (and in older iOS devices), but when loaded in iOS 9.3 (in Xcode Simulator) they are very slow.

I’m also trying to change the code related to the rotation to see what happens.

Instead of object.rotation I’m trying to do it with Transitions and I will post my results here as soon as I’m finished.

Thanks for your help

Why don’t you make a simple app that demos the problem. Sounds like you’ve got a start with the AppLovin sample, but I would suggest you strip it down even more. Drop it in a zip file and post a dropbox link or so here and lets see if we can get some other developers with 9.3 to give it try.

Just out of curiosity, do you have the “fps” set in your config.lua? Are you at 30fps or 60fps? If you’re at 30, make it 60.

Rob

Ok, I will.

Yes I’m at 60fps right now.

Ok, so I stripped down the sample and there are only the two blades rotating.

Try it in Corona and then in Xcode Simulator (7.3.1) or if you can on device with iOS 9.3.2

Link: https://drive.google.com/file/d/0B3VhLT4mAhI5Z1BVVlR3d1FEQW8/view?usp=sharing

Let me know if you have problems downloading the file.

Thanks

On the Xcode simulator (7.3.1), it runs a tad slower than the Corona SDK simulator. On my iPhone 6 (9.3.2) and my iPad 4 (9.3.1) it ran the same speed as the Corona SDK Simulator with no noticeable lag.

Rob

I tried the original app right now and I don’t have the super slow motion as the other day and It seems to work, though not as smoothly as in the Corona Simulator.

When I first tried it after the Apple rejection It was freezing after launch in the menu screen. Then the day after It was slower but no freezing, but very buggy (sometimes the game character did strange movements).

It’s really strange as I haven’t changed any code, apart from deleting the duplicate of blade.X and blade.Y positions today.

The blades are rotating slower than in the sample app I send you in Xcode, but that could be also because the app is heavier than the sample one.

I can’t test on device right now though. If I study how to use Test Flight would you be so kind to test my app on device before I’ll send it to Apple?

thanks for the help

I can certainly try. But remember there is a whole community here to help.

Rob

Ok, thank you. I’ll send you a message when It’s ready to test

I don’t have a chance to build the project and test it out right now but when you have a build ready for TestFlight, I can test it out on an iPhone 5 with iOS 9.3.2. Send me a message if you want.

Rob I can’t send you a private message so when you read this you can send me an email I can use for TestFlight.

thank you

@bgmadclown: thanks! I will send you a message when It’s ready.

The app is currently waiting for Beta App Review for TestFlight, so we’ll see how It goes on device.

In the meantime I was thinking that the problem might be caused by how the Blades are attached to two Objects in the game.

Basically there are two tubes (as objects) closing down at user touch and attached to these tubes there are two rotating blades (as just images), so that when the tubes are moving also the blades are moving with them (while always rotating).

I did this by just stating the X and Y positions of the blades as follow:

blade2.x = pipeBottomPiece.x; blade2.y = pipeBottomPiece.contentBounds.yMin; blade1.x = pipeTopPiece.x; blade1.y = pipeTopPiece.contentBounds.yMax;

Could this cause a problem of lagging or freezing during the game? Is this the proper way to attach a rotating image to a moving object?

Thanks

Are you using physics?

Just for the pipes, not for the Blades as I don’t need collision for them.

You might want to consider joints. I think a weld joint would work for this.  See:

https://docs.coronalabs.com/guide/physics/physicsJoints/index.html

Rob

I tried to implement the Weld Joint in my app and It works great, though I do still have some problem with rotation.

I added physics on my blades:

local blade2 = display.newImageRect(group, "IMG/blade.png", 70, 70); physics.addBody(blade2, "dynamic"); blade2.gravityScale = 0; blade2.x = pipeBottomPiece.x; blade2.y = pipeBottomPiece.contentBounds.yMin;

and I joint them successfully with the pipes:

local weldJoint2 = physics.newJoint( "weld", pipeBottomPiece, blade2, pipeBottomPiece.x, pipeBottomPiece.contentBounds.yMin )

Now for the continuous rotation I couldn’t keep rotation.object as It doesn’t seem to work for physical objects, so I tried transitions:

local onComplete2 = function( self ) self.rotation = 0 blade2Transition = transition.to( self, { rotation=360, time=500, onComplete = self }) end blade2.onComplete = onComplete2 blade2Transition = transition.to( blade2, { rotation=360, time=500, onComplete = blade2 })

This works really well in the Corona Simulator, but when I try it in the Xcode Simulator with iOS 9.3 It speeds up the rotation and It looks a bit buggy, but still works.

I was wondering what happens with rotation in iOS 9.3 and I found this forum post: https://forums.coronalabs.com/topic/2252-how-to-make-object-follow-another-object/

Could the game timer be the problem with my app in iOS 9?

thanks