2014-12-03 17 views
2

在可能使用iOS 5.x/OS X 10.7部署目標或更新的目標構建的庫中,我正確定義了一個dispatch_queue_t屬性。CocoaPods庫中的強dispatch_queue_t

因爲我可以解決這個問題的建議here大部分:

#if OS_OBJECT_HAVE_OBJC_SUPPORT // == 1 not really needed 
@property (nonatomic, strong) dispatch_queue_t loggerQueue; // An Objective-C object 
#else 
@property (nonatomic, assign) dispatch_queue_t loggerQueue; // A C pointer 
#endif 

手動創建靜態庫或包括直接在項目中的文件時,當這個工作。

將此代碼添加到CocoaPods庫中時,它會中斷iOS 6 +/OS X 10.8+部署目標。 CocoaPods正確設置了部署目標,編譯器設置了OS_OBJECT_HAVE_OBJC_SUPPORT == 1並選擇了strong定義。但是iOS的5.x的/ OS X 10.7的錯誤,我得到:

Property with 'retain (or strong)' attribute must be of object type

我想比較的CocoaPods和靜態庫,但沒有什麼看起來可疑之間所產生的環境變量。

#if OS_OBJECT_HAVE_OBJC_SUPPORT && !defined(COCOAPODS) 
@property (nonatomic, strong) dispatch_queue_t loggerQueue; // Always disabled 
#else 
@property (nonatomic, assign) dispatch_queue_t loggerQueue; 
#endif 

回答

2

Seems如老式的CocoaPods被重新定義OS_OBJECT_USE_OBJC打破OS_OBJECT_HAVE_OBJC_SUPPORT

現在我已經完全禁用strong定義用的CocoaPods建設時,修補它。

我們通過檢查OS_OBJECT_USE_OBJC並使用較新的CocoaPods得到了這個fixed