nsnumber

Getting error when added NSNumber to an array

When my program gets to the line: [userNumSequence addObject:[NSNumber numberWithInteger: sequenceNumber]]; it gets the error: Program received signal: “EXC_BAD_ACCESS”. All I'm wanting to do is to store an integer in the array. // JBNumberGeneration.m #import "JBNumberGeneration.h" @implementation JBNumberGeneration - (id) init...

Core Data Migration loses NSNumber value

After migration, one of my numerical values that should be non-zero now appears as zero. If I don't migrate, the value retains its non-zero value. I first tried to set a number value in a managed object like this: [temp setNumUses:temp.numUses+1]; ... but that caused an'EXC_BAD_ACCESS' so I changed it to: int hold = ((int)[[temp val...

NSPredicate, NsNumber numberWithFloat:0.0 (iPhone)

hi i have Core Data database with numerical attributes. they are NSNumbers. Default value is 0.0 but when i try to do some NSPredicated fetch, i get "'NSInvalidArgumentException', reason: 'Invalid predicate: nil RHS'" just because attribute value is 0.0 The predicate is created with: [NSPredicate predicateWithFormat:@"(startValue => %...

[NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt,0)];

i m using sqlite i am geting a return value frmo DB in this manner "returnCount = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt,0)];" but the returend value is an integer value. how can i get a int value instead of paasing it in string...like this thing here "[NSString stringWithUTF8String:(char *)sqlite3_col...

Compare a NSNumber to an int

Hi! I've a simple question (I think): I'm trying to compare a NSNumber with a int, to see if it is 0 or 1. Here is the code: id i = [dictionary objectForKey:@"error"]; //class = NSCFNumber NSLog(@"%@ == 0 -> %@", i, i == 0); NSLog(@"%@ == 0 -> %@", i, [i compare:[NSNumber numberWithBool:NO]]); I tried this to methods but I get null a...

How do I properly create static NSArrays full of NSNumbers in Objective-C (Cocoa)?

Why is it that in the following code, I can not just simply make a static array of NSNumbers? I would just use C arrays and ints, but those cannot be copied and as you can see in init(), I have to copy the array to another one. The error I recieve is "Initializer element is not constant." It's very confusing; I'm not even sure what that ...

NSArry of floats issue

Hi, Im trying to create an NSArray of floats. However, once the value is added to the arrays it is alway 0.0000000. What am i doing wrong? NSLog(@"percent: %f" , percent); prints the correct value and NSLog(@"timeArray: %f", [timeArray objectAtIndex:i]); is always 0.00000. NSMutableArray *timeArray = [[NSMutableArray alloc] ...