GData static library: exclude files from ARC with -fno-objc-arc?

后端 未结 1 1720
执笔经年
执笔经年 2021-01-16 02:36

I am using the GData static library in my app that uses ARC. Google\'s instructions say to link the header files from the library to the project target.

The problem i

相关标签:
1条回答
  • 2021-01-16 03:16

    Well I asked and found the unswear 10 minutes later. Any way if it will help someone:

    1. The problem is only with the .h files, Goole remark is only for cases you embed the library not as static library.
    2. After someone reported the problem to google, they added new macros that solve the problem, this is how:

    search the header files for file named : GDataDefines.h and add this code inside:

    //
    // Simple macros to allow building headers for non-ARC files
    // into ARC apps
    //
    
    #ifndef GDATA_REQUIRES_ARC
    #if defined(__clang__)
    #if __has_feature(objc_arc)
    #define GDATA_REQUIRES_ARC 1
    #endif
    #endif
    #endif
    
    #if GDATA_REQUIRES_ARC
    #define GDATA_UNSAFE_UNRETAINED __unsafe_unretained
    #else
    #define GDATA_UNSAFE_UNRETAINED
    #endif
    

    Then in the GDataObject.h which causes the ARC errors

    Change the GDataDescriptionRecord struct to

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

    And the

       __weak GDataObject *parent_;  // parent in tree of GData objects
    

    to

       GDataObject GDATA_UNSAFE_UNRETAINED *parent_;
    

    This is the link to google update: http://code.google.com/p/gdata-objectivec-client/source/detail?r=712

    That's it.

    Hope it will help someone

    Shani

    0 讨论(0)
提交回复
热议问题