Questions tagged [nsinteger]

An NSInteger is a data type in Objective-C. It is used to describe an integer.

An NSInteger is data type in Objective-C used to describe an integer. When building 32-bit applications, NSInteger is a 32-bit integer. A 64-bit application treats NSInteger as a 64-bit integer.

258 questions
1
vote
1 answer

integer declaration issue

I am struggling with bug in my program. and finally i got the point. here integer shows value 1 at the time of declaration. I clean and build again. but it shows 1 value? please any one explain me why this happen?
QueueOverFlow
  • 1,336
  • 5
  • 27
  • 48
1
vote
4 answers

NSInteger returning 0 if NSString is NULL

This could be the simplest one but I am not able to find the exact cause. Instead to explain in words following is my code: NSString *str = @""; NSInteger tempInteger = [str integerValue]; if (tempInteger == 0) { NSLog (@"do something"); } If…
iMash
  • 1,178
  • 1
  • 12
  • 33
1
vote
2 answers

NSUserDefaults registerDefaults with NSInteger

I am using NSUserDefaults to store some integer settings for my app, but I want to register default values for these settings, using code like this: NSDictionary *appDefaults = [[NSDictionary alloc] initWithObjectsAndKeys:(NSInteger)0,…
colincameron
  • 2,696
  • 4
  • 23
  • 46
0
votes
2 answers

Different int values or the same? EXC_BAD_ACCESS at NSLog

I have this code: likeButton.tag = spik._id; NSLog(@"spik ID=%@ likebtn.tag=%@",spik._id,likeButton.tag); NSLog(@"%@", likeButton); where spik._id is NSInteger And this is the output: 2012-03-11 19:35:37.751 KwikSpik[44277:ce03] spik ID=39975 …
Ilya Blokh
  • 11,923
  • 11
  • 52
  • 84
0
votes
2 answers

Can't do mathematical operations with int from NSUserDefaults

i have integer data, stored in NSUserDefaults, there is my code: - (IBAction)addButton:(id)sender { NSInteger oldValue = [[NSUserDefaults standardUserDefaults] integerForKey:@"myValue"]; NSString *string1=[addTextField text]; int add…
Necrosoft
  • 9
  • 1
  • 4
0
votes
1 answer

NSInteger value changing when loading view

I have an NSInteger in my app delegate called healthInt. In the app delegate i have healthInt set to 100. And when the application loads the first view healthInt is still equal to 100. But when it loads the next view, healthInt is set to 0. Even…
0
votes
1 answer

pointer to integer

I have an array of integer and i'm trying to get an element from the array; xcode keeps showing this message: "initialization makes integer from pointer without a cast" I know that this warning means that i can't alloc integer to pointer type, and…
Hamdi-Lachaal
  • 151
  • 1
  • 3
  • 8
0
votes
2 answers

How to convert values from NSString to NSInteger

I am new to iPhone development. I would like to fetch records from a database using the procedure mentioned below. But when I passed the searched value of searchDbAuthorId1 or searchDbQuoteId to a method, it showed a BAD ACCESS message.…
Developer
  • 99
  • 1
  • 4
0
votes
2 answers

Iphone Application terminate due to uncaught exception 'NSInvalidArgumentException'

I have an application in which i use this code for save data in local prefences. -(IBAction)radio_button:(id)sender{ switch ( ((UIButton*)sender).tag ){ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; case 0: { …
iRavan12
  • 101
  • 6
0
votes
0 answers

NSInteger argument invalid value

I have the following class: @interface MyObj : NSObject { NSInteger _x; NSInteger _y; .... } @property(nonatomic, readonly) NSInteger x; @property(nonatomic, readonly) NSInteger y; .... -…
ArisRS
  • 1,362
  • 2
  • 19
  • 41
0
votes
3 answers

Why is my code working with me initializing NSInteger?

Possible Duplicate: (Objective-)C ints always initialized to 0? I have an interface @interface MyInterface { NSInteger _count; } @end Then in my implementation I am just using is as if (_count==0) { //do somthing } _count++; And it works…
Java Ka Baby
  • 4,880
  • 11
  • 39
  • 51
0
votes
2 answers

Problem with isEqualToString: method and NSInteger

This is my code: for (int i=0; i
paul_1991
  • 231
  • 1
  • 7
  • 16
0
votes
2 answers

Store NSInteger in Core Data

Is there any way I can skip dealing with NSNumber and work directly with NSInteger?
Andoriyu
  • 212
  • 7
  • 17
0
votes
1 answer

Return value through parameter NSInteger

I need to read 3 values from a database and return them in a method. I'm having trouble to understand how to return values using NSInteger types. This is the code: NSString* GetVerbInfinitive(FMDatabase* mydb, NSString* myConjugation, NSInteger…
Miguel E
  • 1,316
  • 2
  • 17
  • 39
0
votes
6 answers

Problem with int in Objective C

singelton.categoryId = (int)[categories.categoriesId objectAtIndex:indexPath.row]; NSLog(@"%d", singelton.categoryId); singelton.categoryId is from type int. But when I try to print it number is random, but if I do this NSLog(@"%@",…
nyanev
  • 11,299
  • 6
  • 47
  • 76