2014-09-22 49 views
0

我有一個頭文件ApiManager.h使用枚舉,其中我定義一個枚舉:在目標C的方法參數

typedef enum ApiEndpoint { 
    // some values 
} ApiEndpoint; 

在該文件中,我有取這些值作爲參數之一的方法:

- (NSString *) getPathForEndpoint: (ApiEndpoint) endpoint; 

而這似乎是XCode罰款。在另一個文件,但是,ApiManagerDelegate.h,我有以下定義:

- (void) requestToEndpoint: (ApiEndpoint) endpoint succeeded: (id) responseObject; 
- (void) requestToEndpoint: (ApiEndpoint) endpoint failed: (NSError *) error; 

和XCode的標誌雙方的ApiEndpoint論點錯誤expected a type。我已導入ApiManager.h,因此ApiEndpoint會顯示在完成列表中,但由於某種原因,XCode無法識別它。

我在做什麼錯?

+0

我建議使用typedef NS_ENUM(NSInteger,UITableViewCellStyle)宏來定義您的枚舉。 – singingAtom 2014-09-22 21:11:13

回答

0

正如@trojanfoe指出的那樣,它看起來像循環依賴是問題,他已經神祕地刪除了他的答案。

typedef移動到單獨的文件ApiEndpoint.h解決了問題。