'Project Name' was compiled with optimization - stepping may behave oddly; variables may not be available
afnetworking-2, ios, xcode7
Solution
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
Problem
Trying to step into AFNetworking code generates following warning: ``` [Project Name] was compiled with optimization - stepping may behave oddly; variables may not be available. ``` And of course I'm not able to debug the code. To be specific I'm trying to debug `UIImageView+AFNetworking` category which seems impossible. Changing the code has no effect (tried `NSLog`, etc) and when trying to step in compilers goes to assembly code and shows `UIImageView+TVASTAFNetworking` as category name which does not exist anywhere in the code base. Using Xcode 7. iOS 9 & 8. Cocoapods (no Framework) UPDATE I forgot to mention that Optimizer is set to `none` for both release and debug configuration and I am in fact using `Debug` config. UPDATE 2 `Strip Debug Symbols` Is off as well.