Reputation: 524
In my interface header file I have:
@proprty (readwrite, assign) float longitude;
If I assign a value to that property like this:
loc.longitude = [[NSString stringWithUTF8String:(const char *)attr->children->content] floatValue];
The debugger says [loc longitude] does not appear to point to a valid object.
but if I use
NSLog(@"%f", [[NSString stringWithUTF8String:(const char *)attr->children->content] floatValue]);
the float value is written.
What am I doing wrong, its like the value is not being assigned to the property?
Upvotes: 0
Views: 349
Reputation: 385600
You said “The debugger says [loc longitude] does not appear to point to a valid object.”
I suspect that you are trying to use this debugger command:
po [loc longitude]
The problem is that [loc longitude]
is indeed not an Objective-C object. It is a float
. You need to use a different command to print it:
p (float)[loc longitude]
or, on a recent-enough version of Xcode/lldb, you can use the dot syntax directly:
p loc.longitude
Upvotes: 1
Reputation: 118671
Indeed, [loc longitude]
is not an object. This means you can't use po
in the debugger; use p
instead.
Upvotes: 0