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

Comparing NSIntegers (or int) to NSUInteger (or unsigned int)

I have a fairly large app (objective-c), I decided to turn on the "Sign Comparison" warnings. I now have almost 100 of them. Most of them are similar to this: if (recentSearches.count > indexPath.row) { //something } and the errors are similar…
Nathan
  • 139
  • 10
0
votes
2 answers

Retrieve 1 specific key from several NSArrays and add them together

In my app, I am needing to loop through each NSArray, get the NSInteger associated with the key 'people' in the NSArray, and then add them all together. What would be a good starting point for first retrieving each specific NSInteger from each…
user717452
  • 33
  • 14
  • 73
  • 149
0
votes
2 answers

String conversion to large integer value

I am using the code below. I could successfully get the string value. But when it is converted to NSInteger, a minus appears in the front, and the value changes. Am I missing something? NSInteger bannerStamp = [[eachDict objectForKey:@"timeStamp"]…
VARUN ISAC
  • 443
  • 3
  • 13
0
votes
1 answer

Conflicting parameter type in implementation of NSInteger vs NSInteger*

There are 'conflicting parameter type in implementation...', as you can see in the image below. This code is working well, but the warning won't go away. Can someone explain what's going on here In the .h file @property (nonatomic) NSInteger…
Vins Rach
  • 41
  • 9
0
votes
2 answers

NSInteger problem

How to use the NSInteger give example and simplecode
sudhakar
  • 51
  • 1
  • 6
0
votes
1 answer

Add NSIntegers ONLY when 2nd NSInteger Changes Value

I realize that a for-loop would likely be the best way to do this, I just don't know the proper way to say for every 5 obstacles passed, add 1 to the totalScriptures integer I have an app similar to flappy bird. An object passes between two…
user717452
  • 33
  • 14
  • 73
  • 149
0
votes
1 answer

inserted type does not match in NSMutableArray

I am facing a very wierd problem. I try to understand what is going on. Simply speaking, I was trying to insert a NSInteger to a NSMutableArray. keys is the NSMutableArray. key is of type NSInteger. [keys insertObject: [NSNumber numberWithInteger:…
Seawind Shi
  • 143
  • 1
  • 2
  • 13
0
votes
2 answers

When should we use 'int' on iOS App based on arm64 architecture?

What is the advantage of using 'int' on arm64 architecture? Since Apple forces apps using arm64 on next February, and it suggests us using NSInteger, most of value we will probably be 8 bytes, like size_t, time_t, etc. And also, most apps face no…
allenlinli
  • 2,066
  • 3
  • 27
  • 49
0
votes
2 answers

Math not coming up right in NSInteger Objective C

So I've got a basic math equation I'm trying to perform in programming. NSInteger testValue = (self.waveform.zoomStartSamples/self.waveform.totalSamples)*100; Self.waveform.zoomStartSamples is @property (nonatomic, assign) unsigned long int…
MScottWaller
  • 3,321
  • 2
  • 24
  • 47
0
votes
2 answers

String formatting %ld for NSInteger suggests (long)?

When I use %d with an NSInteger, Xcode suggests using %ld and casting the NSInteger with (long). But when I just use %ld without the (long)myNSInteger, the warning goes away. Which should I use?
quantumpotato
  • 9,637
  • 14
  • 70
  • 146
0
votes
1 answer

NSObject to Int (Swift)

Is it possible to convert a NSObject to an Int? and how can I implement this? I've look the Apple Reference Guide but I can't seem to understand how to use intValue under NSObject reference. var intValue: Int32 { get } I receive a NSObject from…
Raul Gonzalez
  • 875
  • 1
  • 10
  • 23
0
votes
2 answers

Value conversion issue?

For some reason I keep getting the "implicit conversion loses integer precision" error and it says it changes it from unsigned long to int (in the section where I am trying to randomize the question). I am very new to programming and I don't know…
Matt
  • 57
  • 6
0
votes
1 answer

Comparing two NSIntegers results in < nil > instead of false

having a weird issue comparing two NSIntegers after doing a subtraction, any ideas why this comparison returns "< nil >" instead of false? I checked to make sure I had values for all variables in the debugger NSInteger totalPhotosLeft =…
yoshyosh
  • 13,956
  • 14
  • 38
  • 46
0
votes
1 answer

Would ignoring the yellow warnings that show up when I run profiler be an a issue if no warnings show up when I build and run my project in XCode?

Coming to the end of a project and it has been a long few months of a mixture of stress and relief. I'm testing the app using instruments now and noticed when I run profile I get a bunch of yellow warnings that never showed up when I built and run a…
LondonGuy
  • 10,778
  • 11
  • 79
  • 151
0
votes
1 answer

"Nil" value Error if NSString value is used for audioFilePath-AVAudioPlayer

I have 114 audio files named from "0" to "113". Now AVAudioPlayer will load the audio file depends on which row is been selected by the user. For example if user selects row at indexPath 0, "0.mp3" file will be loaded. Now to make it work, i am…
Mo Asif
  • 25
  • 5