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
0
votes
1 answer

Why am I getting strange values in my NSInteger object?

I am parsing XML that gets returned from a web service. If it is a valid user than I should be getting a long integer back. (for example: 2110504192344912815 or 2061128143657912001). If it is invalid then I get a 0. However if you see my code, I am…
Strong Like Bull
  • 11,155
  • 36
  • 98
  • 169
0
votes
1 answer

Pull serverOutputValue as NSInteger

Ho Everybody I aam trying to call php script thorugh my iphone application that return me a integer value as serverOutput NSData *dataURL = [NSData dataWithContentsOfURL: [ NSURL URLWithString: hostStr ]]; NSString *serverOutput =…
Amrit
  • 423
  • 6
  • 22
0
votes
2 answers

iOS/Objective-C: NSInteger gets lost during simply Coordinates2D object creation

I'm tearing my hair out over this.. I've no idea what's going wrong. I've created a very simple Coordinates2D class to store two NSInteger values, as well as a string representation for use with NSLog. I'm running this code in the iOS 4.3 iPad…
KomodoDave
  • 7,239
  • 10
  • 60
  • 92
0
votes
2 answers

Why does this conditional cause an error?

I have a method that contains a few conditionals. The first conditional works fine and does not cause any problems. However, the second one causes the app to crash. - (void)didReceiveGaiaGattResponse:(CSRGaiaGattCommand *)command { …
VK1
  • 1,676
  • 4
  • 28
  • 51
0
votes
1 answer

NSInteger 0+0=4300282608

I am developing a simple calculator app to understand how OSX development works (this is not homework). When addAction(_ sender: NSButton) is fired it adds the currentCount and amountToAdd together then updates the currentCount and sets that to…
Stephen Collins
  • 343
  • 1
  • 2
  • 10
0
votes
3 answers

variable accessibility problem in iphone

I have two class .. in one of them I am using six buttons with their tag.. like this [btnF1 setTag:1]; and I am using this tag like this.. - (void)showPhoto:(UIButton*)btnSender { NSLog(@"showPhoto:%d",btnSender.tag); } Now I…
Jean-Luc Godard
  • 1,873
  • 3
  • 28
  • 53
0
votes
1 answer

Comparing NSInteger and NSUInteger

I have two variables that I need to compare, in order to check if an index exists in an array: indexPath.row is NSInteger [self arrayOfData].count is NSUInteger The problem is that they are of different types and when indexPath.row=-1 it gets…
Peter G.
  • 7,816
  • 20
  • 80
  • 154
0
votes
1 answer

Add cell to an Array using data from a UIPickerView?

I have a UIPickerView with three components, and each component has NSIntegerMax for the numbers. So, I just need to get the data from each component, and send it to another ViewController called, CreationViewController. The three objects I need…
Nathan
  • 151
  • 4
  • 16
0
votes
1 answer

Calculating indexPath.row times a number

I am trying to set an NSInteger to indexPath.row * 2 but I get an error: Incompatible integer to pointer conversation initializing 'NSInteger *' (aka 'long *') with an expression of type 'long' Here's my code NSInteger *titleToDelete =…
0
votes
1 answer

Pass NSInteger to a tableView controller

Hi I'd like to pass an NSInteger to a tableView controller and then use it to set a badge. In this case, the NSInteger I'd like to pass is the number of rows in a tableView, returned with Core Data (numberOfRows). -…
matteodv
  • 3,992
  • 5
  • 39
  • 73
0
votes
2 answers

Generating a random negative NSInteger

I'm trying to generate random negative NSInteger using the following code, + (NSInteger)getNegativeRandomNumber { uint32_t random = arc4random_uniform(2147483647); // where 2147483647 is the max 32-bit positive value returned by random function …
Vasu N
  • 344
  • 1
  • 2
  • 9
0
votes
1 answer

Swift3 | Spritekit | Two different NSIntegers with the same userdefaults key is returning wrong saved value

Can anyone explain the following to this please and have a alternative? I've just put a simple example as my code is pretty large. //Declare too variables var levelStars = NSInteger() var levelScore = NSInteger() //Load the…
user3482617
  • 307
  • 1
  • 12
0
votes
0 answers

iOS Percentage Keeps Rounding

I am trying to get an exact percentage for certain parts of my app to two decimal places (73.38%), but no matter what I do, it rounds it to (73.00%). What is going on with this code? NSInteger acceptedCount = objects.count; NSString *inStr =…
user717452
  • 33
  • 14
  • 73
  • 149
0
votes
3 answers

Objective-C handling integer values

I am getting confused with how to handle Integers in Objective C. If I define the following: NSInteger i = 6; NSLog(@"%d", i); I expect it to print 6 to the console. however I have an NSInteger within an object which is obviously reference by a…
Chris
  • 335
  • 2
  • 16
0
votes
3 answers

NSInteger to NSArray iPhone

I have NSInteger variable, for example NSInteger example=1256 and i need an array with elements of this variable. so first element of array is array[0] = 1 array[1] = 2 array[2] = 5 etc.. what way can i solve it ?
Greg
  • 83
  • 2
  • 4