我想在我的ViewController中聲明一個NSInteger
變量,但出現錯誤。類型或屬性(NSUInteger(又名無符號整數))與伊娃(int)的類型不匹配
在我ViewController.h我有
@interface MainViewController : UIViewController{
NSInteger currentSection;
//Other stuff
}
@property (assign,nonatomic) NSUInteger currentSection;
@end
,在我ViewController.m我:
@implementation MainViewController
//Other stuff
@synthesize currentSection;
但我得到這個錯誤:
Type of property 'currentSection' ('NSUinteger' (aka 'unsigned int')) does not match type of ivar 'currentSection' ('int')
爲什麼我用一條簡單的指令得到這個錯誤?
我正在使用Xcode 4.4和ARC。
再次閱讀錯誤消息。或者也許是第一次。 –