Project Name' was compiled with optimization - stepping may behave oddly; variables may not be available
It's been a long time but I finally solved the issue. There is a third optimization flag LTO
or Link Time Optimization
and Surprisingly no one have
mentioned it here and for some reason I didn't pay attention to it either. It's right there above the Optimization Level
setting as you can see in many screen shots posted here.
So to summarize it there are 3 different optimization flags you want to turn off for debugging :
- LLVM Link Time Optimization (
-flto
) - LLVM Optimization Level (
-O
) - Swift Compiler Optimization Level
More information about LTO:
http://llvm.org/docs/LinkTimeOptimization.html
optimization - stepping may behave oddly; variables may not be available in Xcode 9.1
You are receiving this message because you set your target's optimization level to one of the Fast
options.
Set the Optimization Level to None
while debugging to make the message go away and your break points behave normally:
APPNAME was compiled with optimization - stepping may behave oddly; variables may not be available
For anyone who also face this problem, try uncheck the "Strip Engine Code" at File > Build Settings > Player Settings (iOS).
http://docs.unity3d.com/Manual/iphone-playerSizeOptimization.html
How to change the optimization level?
The build settings are tied to configurations. In your build settings for optimization, the Debug configuration is set to nonoptimized, and the Release configuration is set to optimized.
So far, so good.
But which configuration are you actually using when you build? That is determined by the scheme. Use the Scheme Editor to look at the schemes for your different targets. (You will have to look at them one at a time.) In each, look in the Run action. It says which configuration to use. If the pop-up says Release, change it to Debug.
Xcode: Cannot set optimization level for debug
It looks like you've accidentally deleted your debug configuration. To prove this to yourself, look at your project's Info pane. You should see this — but I'm betting you won't:
A configuration is just a name, so you can easily recreate the debug configuration right here in the project settings; but that won't magically restore all the corresponding default build setting values. Your best bet is to consider this project hosed: make a new project, to get the template's values for the build settings, and migrate everything from this project into it.
Related Topics
How to Test Apple Push Notification Service Without an Iphone
Can Afnetworking Return Data Synchronously (Inside a Block)
Detecting Sheet Was Dismissed on iOS 13
How to Compare Two Uiimage Objects
How to Crop a Uiimageview to a New Uiimage in 'Aspect Fill' Mode
Issue Detecting Button Cellforrowat
Uinavigationbar Custom Back Button Without Title
How to Detect If App Is Being Built For Device or Simulator in Swift
Check For Internet Connection Availability in Swift
How to Scale Down a Uiimage and Make It Crispy/Sharp At the Same Time Instead of Blurry
Nsurlconnection and Basic Http Authentication in Ios
How to Create Launch Images For Iphone 6/6 Plus Landscape Only Apps
Ios9 Getting Error "An Ssl Error Has Occurred and a Secure Connection to the Server Cannot Be Made"