Search code examples
iosfacebookpragma

ios Facebook SDK Pragma, GCC error


I have to implement a Facebook sharing method... I watched the video, read a couple of tutors, etc... 1: I registered my app, downloaded the sdk, the samples are running fine 2: when i drag and drop the FacebookSDK.framework into my app (not a new app, it has custom frameworks), and include the #import into the desired class and the appdelegate, during the build, i keep getting the following error in FBRequest.h:

LLVM GCC 4.2 error
'#pragma' is not allowed here

LLVM GCC 4.2 error
instance variable '<unnamed>' has unknown size

LLVM GCC 4.2 error
expected `;' before 'NSError'

This is the problematic area

@interface FBRequest : NSObject {
 @private
    id<FBRequestDelegate> _delegate;
    NSString*             _url;
    NSURLConnection*      _connection;
    NSMutableData*        _responseText;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
    FBRequestState        _state;
#pragma GCC diagnostic pop
    NSError*              _error;
    BOOL                  _sessionDidExpire;
    id<FBGraphObject>     _graphObject;
}

XCode 4.5, trying to run in ios 5.1 simulator and ios6 iPod 4. gen

Thanks


Solution

  • try switching to Apple LLVM compiler 4.1 instead of LLVM GCC 4.2 in your Project > Build Settings > Build Options > Compiler for C/C++/Objective-C

    Build Settings > Build Options > Compiler for C/C++/Objective-C

    p.s. Choose "All" if you don't see "Compiler for C/C++/Objective-C" there.