0

I create a game with Unity for iOS. When Xcode upgrades to 9.3 , sometimes the project crashes with this error when I'm in the game:

was compiled with optimization - stepping may behave oddly; variables may not be available.

I searched and find many ways to fix this problem, but i still get it. I didn't use optimization and i uncheck the code strip in unity setting.

any idea how can i fix it?!

UPDATE:

Another informat

ShouldUpdateTransformBefore():

0x100f9c064 <+0>:  ldr    x8, [x0]
0x100f9c068 <+4>:  ldr    x9, [x1]
0x100f9c06c <+8>:  cmp    x8, x9
0x100f9c070 <+12>: b.eq   0x100f9c07c               ; <+24> at RectTransform.cpp:319
0x100f9c074 <+16>: cset   w0, lo
0x100f9c078 <+20>: ret    
0x100f9c07c <+24>: ldr    w9, [x1, #0x8]
0x100f9c080 <+28>: cmn    w9, #0x1                  ; =0x1 
0x100f9c084 <+32>: b.eq   0x100f9c0a4               ; <+64> at RectTransform.cpp:320
0x100f9c088 <+36>: ldr    w10, [x0, #0x8]
0x100f9c08c <+40>: cmp    w9, w10
0x100f9c090 <+44>: b.eq   0x100f9c0ac               ; <+72> at RectTransform.cpp:327

-> 0x100f9c094 <+48>: ldr x11, [x8, #0x10]

0x100f9c098 <+52>: ldr    w9, [x11, w9, sxtw #2]
0x100f9c09c <+56>: cmn    w9, #0x1                  ; =0x1 
0x100f9c0a0 <+60>: b.ne   0x100f9c08c               ; <+40> at RectTransform.cpp:322
0x100f9c0a4 <+64>: mov    w0, #0x0
0x100f9c0a8 <+68>: ret    
0x100f9c0ac <+72>: orr    w0, wzr, #0x1
0x100f9c0b0 <+76>: ret
Community
  • 1
  • 1
BlackMB
  • 230
  • 6
  • 20
  • I don't know about unity, but you would get this if for example you are installing/running via Xcode but the configuration for the run scheme is set to Release instead of Debug (the Run scheme's configuration is debug by default, but can be changed to release). Are you sure its actually crashing however. – Gruntcakes Apr 11 '18 at 21:57
  • @Gruntcakes you mean that i will not see this error when i release my game to appstore? – BlackMB Apr 11 '18 at 22:00
  • No. That message is nothing to do with the app really, its from Xcode when you try and interactively debug the app. See the 2nd answer here: https://stackoverflow.com/questions/32772573/project-name-was-compiled-with-optimization-stepping-may-behave-oddly-varia – Gruntcakes Apr 11 '18 at 22:05
  • Note that that isn't an error, just a log message. If your app is crashing it is for an unrelated reason (and will probably still happen when you release your game in the App Store) – dan Apr 11 '18 at 22:07
  • @dan i dont have this problem in android! Or in pc when i play it. It happens exactly when this error shows in log. – BlackMB Apr 11 '18 at 22:21
  • That is just a red herring - there is probably an exception occurring in your app, Xcode therefore leaps into action and attempts to display the call stack, it notices its a release build and so displays that message. That message is not the cause of your crash, optimization is not the cause of your crash. Something else is the cause of your crash. – Gruntcakes Apr 11 '18 at 22:53
  • @Gruntcakes oh. So i must review my codes. I ask this question just because i never seen this message. I will update it when i find the problem. Thanks bro – BlackMB Apr 11 '18 at 22:55
  • If you run your app in debug mode via Xcode then when it crashes you should get some indication what the problem is. Xcode is saying it might not be able to display information because the app isn't in debug config. But you want it to be able to do so, so run/build it in debug mode. There's lots of info in the other questions I linked to might help you out. – Gruntcakes Apr 11 '18 at 22:58

1 Answers1

0

Although seems it is too late, I just face similar problem and share the solution here.

Reason

In my case, the application using too much memories causes the testing device crashes. You can test it with a better device. My application crashes in iPhone7 but not in iPhone7 Plus. And you can also check it in the Memory column in the left.

enter image description here

Solution

If application crashes when loading scene, here is the solution, or suggestion.

Assume there are 2 scenes, A and B. Both of them cost 1GB memory.

When A -> B, A will be destroyed after B is loaded, which means 2GB is requested when A + B. It is too heavy for mobile.

So I add scene C, a middleware cost 0.1GB memory.

And now I go to scene B through A -> C -> B.

A + C request 1.1GB, then Scene A releases.

After that, C -> B request 1.1GB.

The maximum memory of loading scene from A to B decrease from 2GB to 1.1GB. It solved my application crashing problem. Hope it helps.

Jacky Hon
  • 151
  • 12