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
votes
2 answers

how to save an NSInteger in NSUserDefaults

I am trying to save an NSInteger (label) into NSUserDefaults but I have not found a way to do this is it even possibel Saving the data [[NSUserDefaults standardUserDefaults] setInteger:label forKey:@"key1"]; Retrieving the data - (void)viewDidLoad…
-2
votes
2 answers

Why is there NSInteger and not NSLong or even NSLongLong?

NSInteger is integer object. So surely there should be long object?
GeneCode
  • 7,545
  • 8
  • 50
  • 85
-2
votes
1 answer

Why would we use a pointer in an NSInteger but not in an NSNumber?

I have an NSInteger that doesn't use a pointer and an NSNumber that does use a pointer. Can someone explain to me why this is the case? All my teacher said was the NSInteger is being used as a type alias but I'm not familiar with that either…
-2
votes
2 answers

Finding the lowest NSInteger from NSArray

I am trying to return the lowest number in an array. Parameter: arrayOfNumbers - An array of NSNumbers. Return: The lowest number in the array as an NSInteger. The code I have thus far doesn't give me any errors, but does not pass the unit tests.…
ioskaveen
  • 196
  • 1
  • 4
  • 14
-2
votes
1 answer

Values of type 'NSInteger' should not be used as format argument Issue

Can someone help me with this Issue/error I'm getting on my iOS app: Values of type 'NSInteger' should not be used as format argument; add an explicit cast to 'long' instead My code in Viewcontroller.m (issue highlighted on first line): NSString…
Ben Nash
  • 1
  • 1
-2
votes
1 answer

NSInteger to NSString bad access exception error in Objective-C?

I'm trying to make an calculator in Objective-C. I have four variables that I'm working with. They are declared in the header file as seen in this code snippet: #import @interface CalculatorAppViewController :…
-2
votes
1 answer

Variables, NSInteger not working in Xcode

Implicit conversion of 'NSInteger' (aka 'int') to 'UILabel *' is disallowed with ARC Ok so this is what I am trying to do- I am following a tutorial on youtube and I have a label on ViewController on Xcode's storyboard and am trying to keep a "high…
PICKme
  • 39
  • 5
-2
votes
2 answers

What is the best way to make an NSInteger return method equal NSInteger parameter?

I tried doing the following method ,but it doesn't work. I need make the current score NSInteger to equal the score parameter in registerScore. Any tips or suggestions will be appreciated. + (void)registerScore:(NSInteger)score { [Score…
-2
votes
2 answers

compare Integer values using array

I have some integer values inside NSMutableArray. I have added a UITextField and a UIButton. If a number is entered inside textfield and clicking on the button does a comparison. If number entered matches, I need to show NSLog. But it's not…
user2674668
  • 117
  • 2
  • 13
-2
votes
1 answer

converting nsinteger to nsnumber strange number

I have a method that receives an nsinteger, then I need to convert it to a nsnumber, but I get a really strange number, my code is: +(TarefaMR *)GetTask:(NSInteger *)idTask { NSLog(@"idTask %@",[NSNumber numberWithInteger:idTask]); …
edounl
  • 65
  • 1
  • 11
-2
votes
4 answers

Issue when retrieving an NSInteger from NSUserDefaults

I'm experiencing an issue when saving & retrieving an int from NSUserDefaults. I am saving to NSUserDefaults using the following code: int globalRank = 1; NSUserDefaults *submissionDefaults = [NSUserDefaults…
JamesLCQ
  • 341
  • 6
  • 12
-2
votes
1 answer

Storing an NSURL return as an integer/numerical value rather than an NSString

I am trying to return the contents of my NSURL request as an integer/numerical value rather than an NSString. I have had quite a bit of trouble with this. Does anyone know what the last line of code needs to be to do this? Thank you! NSString…
Brandon
  • 2,163
  • 6
  • 40
  • 64
-3
votes
1 answer

Apparently ++ means +4 or +8 for an Objective-C integer property

For some reason, when I try to increment one of my integers, it increments by four instead of one! The only thing I can think of is something wrong in the .h file. The integer is declared like this: @property (nonatomic, assign) int *number; and in…
Kiley
  • 409
  • 1
  • 5
  • 19
-3
votes
2 answers

NSInteger cannot be used twice in same multiplication

I am stumped! I am using NSinteger but as all my inputs are integers and the results are therefore integers I can't see the problem that people doing division are having due to rounding. I've looked in the developer guide for NSInteger and cannot…
-3
votes
2 answers

NSString with NSInteger

How can I put my NSInteger into my NSString stringWithFormat: my code: -(IBAction)main:(id)sender { NSAppleScript *script = [[NSAppleScript alloc] initWithSource:@"return the clipboard"]; NSAppleEventDescriptor *clipboardTXT = [[script…
atomikpanda
  • 1,845
  • 5
  • 33
  • 47
1 2 3
17
18