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?
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:
The problem is that
[loc longitude]is indeed not an Objective-C object. It is afloat. You need to use a different command to print it:or, on a recent-enough version of Xcode/lldb, you can use the dot syntax directly: