我將我的iOS應用程序轉換爲64位。我安裝了最新的Xcode 5.1(beta 4)。將應用程序轉換爲64位時typedef枚舉上的警告
當我編譯應用程序時,我收到了100多條警告,其中大部分都很容易修復。不過,我對下面的代碼警告:凡爲CommentResponseStatus
聲明
+ (CommentResponseStatus)commentReponseStatusCodeWithStatusString:(NSString *)_status
{
NSArray *commentStatusString = [NSArray arrayWithObjects:@"success", @"needConfirmation", @"stopped", nil];
return [commentStatusString indexOfObject:_status];
}
:
typedef enum {
success,
needConfirmation,
stopped
} CommentResponseStatus;
我有一個警告「隱式轉換損失整數精度:‘NSUInteger
’(又名‘unsigned long
’ )爲 'CommentResponseStatus
」'
該警告是上線return [commentStatusString indexOfObject:_status];
在NSArray
我們- (NSUInteger)indexOfObject:(id)anObject;
我感到困惑的這一警告,不知道現在如何解決它。任何快速的幫助,將不勝感激。
它的工作!謝謝! –
我嘗試了第二種解決方案,警告消失了。我不確定第一個。我做了一些更多的搜索,並在這裏找到類似的答案:http://stackoverflow.com/questions/707512/what-is-a-typedef-enum-in-objective-c –
我個人建議第一個,因爲它只有一個重構名稱更改的地方。後者有兩個,我也不喜歡後綴命名風格與後者的前綴。 – Erik