Hi,
Sorry about this silly question. I'm trying to learn objc and I'm unable to do a simple sum between 2 int values... In fact problem is before the sum.
I have an object that have an instance variable defined as a NSNumber and it's defined as a property as follows:
@interface MyObj : NSObject {
NSNumber *count;
}
@property (readwrite, assign) NSNumber *count;
@end
@implementation MyObj
@synthetize count;
@end
Then I have a class that will consume MyObj:
- (void)total:(MyObj *)mobj {
int count = [mobj.count intValue];
NSLog(@"%@", mobj.count);
NSLog(@"%@", count);
int total = 10 + count;
NSLog(@"%@", total);
}
The first NSLog prints the mobj.count nicely (let's say 5), but the second one, throws an EXC_BAD_ACCESS. And of course the program never reachs the sum.
So, what I'm doing wrong? I'm trying to convert it to a int based on this post.
TIA,
Bob