I'm new to Objective-C and Cocoa. I've read that NSInteger and NSNumber are preferred when working with simple integers because they're the "platform-safe" versions of the primitive numeric types (and in NSNumber's case, wrapped in an object). So, I need a counter in my class that gets incremented when an NSTimer fires. On an Apple fo...
I'm trying my hand at the iPhone course from Stanford on iTunes U and I'm a bit confused about pointers. In the first assignment, I tried doing something like this
NSString *processName = [[NSProcessInfo processInfo] processName];
NSInteger *processID = [[NSProcessInfo processInfo] processIdentifier];
Which generated an error, after t...
Hello, and thanks in advance for you time.
I am trying to filter out certain types of playlists for an iphone app (genius and On-the-go, specifically). the documentation says that the property attribute MPMediaPlaylistPropertyPlaylistAttributes will return the attributes associated with a playlist in the form of an NSNumber containing a...
What's the difference between NSNumber and NSInteger? Are there more primitives like these that I should know about/use? Is there one for floats?
...
NSDictionary *topic = [spaces objectAtIndex:i];
NSInteger topicid = [topic valueForKey:@"TOPICID"];
when I run this and print out topic I get the following:
Printing description of topic:
<CFDictionary 0xdb2a70 [0x30307a00]>{type = mutable, count = 2, capacity = 12, pairs = (
10 : <CFString 0xdb5300 [0x30307a00]>{contents = "TOP...
hi,
e.g. NSInteger called a
[a value] is a EXC_BAD_ACCESS
how to convert NSInteger to int ?
(only small numbers < 32 are used)
...
What would be the reason to use an NSInteger vs an int in iPhone programming? Thanks.
...
Is it true that you can't have an NSMutableArray of NSIntegers? When I try to add the values to the array and then print them out they're huge numbers (when if I print out the tag to NSLog they're 0,1,2,3 etc.).
I'm trying to create an array of my UITabBarItem's tags so I can save the order and retrieve it later. Am I forced to do some ...
I was wondering what is the rationale behind different styles of enum declaration on cocoa?
Like this:
enum { constants.. }; typedef NSUInteger sometype;
Is the reason to use typedef to get assigments to NSUInteger to work without casting?
Sometimes the typedef is either of NSInteger/NSUInteger, why not use NSInteger always? Is th...
How to convert an NSNumber to NSInteger ?
...
DetailViewController.h
@interface DetailViewController : UIViewController {
NSInteger getInteger;
NSNumber *getNumber;
}
@property (nonatomic, retain) NSNumber *getNumber;
@property (nonatomic, retain) NSInteger getInteger => Doesn't work with warning.
hi, guys. I have a question about NSInteger. I know that NSNumber is abl...
Hi all,
How can i convert int64_t to NSInteger in Objective-C ?
This method returns into score an int64_t* and I need to convert it to NSInteger:
[OFHighScoreService getPreviousHighScoreLocal:score forLeaderboard:leaderboardId];
Thank you.
...
Hi. I'm having some trouble passing a number as an argument for a method:
-(void) meth2:(int)next_int;
And to call that method i need this:
int next_int = 1;
[self performSelectorOnMainThread:@selector(meth2:) withObject:next_int waitUntilDone:NO];
//update next_int and call meth2 again
at this point i get a "pointer from integer w...
Hi..
How do i go about seeing if my integer is in an array of integers...
eg i want to know if 7 is in an array of [ 1 3 4 5 6 7 8]
any ideas?
Thanks
...
How to use the NSInteger give example and simplecode
...
Hi everybody:
I'm sure I'm missing something and the answer is very simple, but I can't seem to understand why this is happening. I'm trying to make an average of dates:
NSInteger runningSum =0;
NSInteger count=0;
for (EventoData *event in self.events) {
NSDate *dateFromString = [[NSDate alloc] init];
if (event.date != nil) {
...
I've been building a framework and writing unit tests in GHUnit. One of my Framework's accessor methods returns an NSInteger.
I assert the expected value in the tests like this:
GHAssertEquals(1320, request.port, @"Port number should be 1320");
When running my tests with an AppKit UI based frontend this assertion passes.
However, w...
Hello,
How can I tell in objective-c coding if an integer is positive or negative. I'm doing this so that I can write an "if" statement stating that if this integer is positive then do this, and if its negative do this.
Thanks,
Kevin
...
Hi friend,
I working on grouped table view based work in that in that i want to convert the value of NSarray into integer for specifing to section value of numberOfRowsInSection but it throws expection on putting following code.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
int sec;
if (...
I have a crazy problem when comparing an NSInteger to int, as follows:
NSInteger count = [dictionary count];
if (count == 0) {
// Do something
}
else {
// Do something
}
When the count is zero, the snipped code in the if clause is run, but when the count number is changed, the snipped code in the if clause is not run (this is...