Reputation: 767
I want to have a array which contains long
value. this one contains int
.
@property (nonatomic,retain) NSMutableArray *selectedMessages;
adding element to it:
[selectedMessages addObject:[NSNumber numberWithInteger:id]]
retrieving each element:
for (id selectedMessageId in self.selectedMessages) {
// selectedMessageId is int
}
How should I change this to store long values?
Upvotes: 0
Views: 236
Reputation: 21808
NSNumber
class has numberWithLong
and longValue
methods.
In your example selectedMessageId
is not int
. It is NSNumber
. You can retrieve its int
value by using intValue
method. Therefore as you need long
use methods that I've provided above
Upvotes: 1