2012-03-27 2 views
2

내 프로젝트에서 ARC를 사용하고 ARC 호환이 아닌 GDATA API를 사용하고 싶습니다. 단일 파일에 대해 ARC를 비활성화하는 방법을 알고 있습니다 (해당 파일에 대해 -fno-objc-arc 컴파일러 플래그를 추가). 그러나 GDataObject.h 파일에 그것은.h 파일에 대해 ARC 비활성화 iphonesdk

나는이 문제를 방지 할 수 있습니다 방법
ARC forbids object in struct or union 

같은 오류가 발생

typedef struct GDataDescriptionRecord { 
    NSString *label; 
    NSString *keyPath; 
    enum GDataDescRecTypes reportType; 
} GDataDescriptionRecord; 

같은 구조 defenition있다. 사용할 수있는 ARC 호환 GDATA API 또는 .H 파일

에 대한 호를 비활성화 할 수있는 방법이 있습니까
+1

가능한 복제본 [GData 정적 라이브러리 - -fno-objc-arc를 사용하여 ARC에서 파일 제외] (http://stackoverflow.com/questions/8300030/gdata-static-library-exclude-files-from-arc- with-fno-objc-arc) – zoul

답변

6

I는 다음과 같이 사용합니다 :

#if __has_feature(objc_arc) 
#define ARC_MEMBER __unsafe_unretained 
#else 
#define ARC_MEMBER 
#endif 

그런 다음, 당신의 구조는 다음과 같이 보일 것입니다 :

typedef struct GDataDescriptionRecord { 
    ARC_MEMBER NSString *label; 
    ARC_MEMBER NSString *keyPath; 
    enum GDataDescRecTypes reportType; 
} GDataDescriptionRecord;