When trying to create a category for NSInteger, the compiler complains that it “Cannot find interface declaration for ‘NSInteger'”. Is it not possible to create an NSInteger category?
A simple test will show the compiler error:
#import <Foundation/Foundation.h>
@interface NSInteger (NSInteger_Extensions)
-(NSInteger)simpleTest;
@end
#import "NSInteger_Extensions.h"
@implementation NSInteger (NSInteger_Extensions)
-(NSInteger)simpleTest {
return self + 5;
}
@end
Should this be possible?
Thanks!
NSinteger is not an interface. So it’s not possible.
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_DataTypes/Reference/reference.html
From the link above:
PS:
But you can make a category of
NSNumber. I think it’s the thing you want to do