2010-08-12 65 views
3

這看起來像一個非常愚蠢的問題,但我不明白爲什麼我會收到錯誤。Objective-C無法將NSInteger分配給NSInteger變量?

我作爲一個實例變量聲明:

NSInteger *scopeSelected; 

我使用這個變量用來跟蹤哪些範圍已經在UISearchDisplay控制器被選中的:

- (BOOL)searchDisplayController:(UISearchDisplayController *)controller 
shouldReloadTableForSearchScope:(NSInteger)searchOption { 
    scopeSelected=searchOption; 
    return YES; 
} 

然而,我繼續在作業線上拋出此警告:

賦值使整數指針變爲 沒有演員表

有人可以告訴我我的代碼有什麼問題嗎?是不是隻是一個NSInteger NSInteger分配?

回答

18

NSInteger是一個int

變化:

NSInteger *scopeSelected; 

到:

​​
+0

無法相信我忘了指針。感謝百萬falconcreek :) – unicornherder 2010-08-12 17:06:33