Are you sure you are not in "Release mode"?
If you want to see variable values you have to be in "Debug mode" (click on your project name on the top left corner near start/stop buttons, then "Edit scheme...", then "Run" settings, then "Info" tab, then "Build Configuration". Here set "Debug". If it was on "Release" that's the matter you saw all nils).
I've set "Optimization Level" for Debug configuration to "None" and it solved problem.
Build settings
Debug
Apple Clang - Code Generation
check Optimization Level
Debug
to None [-OO]
After that, you will be able to see variable values in the debug area or console.
Make sure that Address Sanitizer is turned off in your Scheme settings. The Address Sanitizer does not work well with the debugger.
It seems everyone has their own solution.
For me, I use Objective-C
and Swift
at the same time.
First of all, go to TARGETS -> Build Settings
and search the code generation
You’ll find Apple LLVM 6.0
and Swift Compiler
Change their Optimization Level
all to None
, then Debug, you may find the value not nil
Amazingly once you can see the value, you solve this problem permanently, then you can change the Optimization Level
to it used to be.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With