A lot of time (when it\'s not every time) I got the following error when I try to print objects on lldb. Is there some build/debug configuration to change or is this an erro
As already said in this other question:
In Build Settings, setting Precompile Prefix Header to NO fixed it for me.
I was having this problem and it went away when I edited my scheme and set the Run build to Debug. I had set it to AdHoc for testing Push Notifications and that apparently makes LLDB unhappy.
Because it's optimized away. Let's use an example:
void f(int self) {
// Here, "self" is live:Its value is used in the call to NSLog()
NSLog(@"I am %d",self);
// Here, "self" is dead: Its value is never used.
// I could do self=0 or self=self*self and nobody would know.
// An optimizing compiler will typically optimize it away.
// It might still be on the stack (in the parameters passed to NSLog())
// but the compiler shouldn't assume this.
NSLog(@"Another function call: %d", 1);
// If "self" was on the stack, it will probably now have been overwritten.
}
Compilers do a lot of things to make your code faster/smaller; forgetting about variables which are no longer needed is a very common optimization.
I usually get this error when I have compiler optimization turned on. The compiler will generate code which does not necessarily follow your code logic flow.
Go to your project in the navigator -> Target -> Build settings -> Search for optimization level -> expand optimization level -> select the debug line -> change to none in both columns of your project and target.
Hope this helps.