iosobjective-cxcodeacaccount

error in ACAccount.h in Simulator-iOS 7.1


I'm trying to build and test an app with the xcode simulator, but during the building I get errors in ACAccount.h, ACAccountType.h, etc. The "strange thing" (at least for me as i'm completely new in using xcode) is that if I click on the .h files with errors they do not appear under the project code but under

Simulator - iOS 7.1-> Frameworks -> Accounts -> ACAccount.h

which is unmodifiable.

Examples of the errors are:

line:

 @class ACAccountType,ACAccount Credential;    --> Illegal interface qualifier

 ACCOUNTS_CLASS_AVAILABLE(NA, 5_0)
 @interface ACAccount : NSObject       -->Objective-C declarations may only appear in global scope

If the .h are predefined files.. How can I solve these errors?

Many thanks in advance!


Solution

  • Generally when you encounter items like the 'illegal interface qualifier' in system provided headers it indicates that you've placed the #import statement within an @interface block, like:

    @interface foo ()
    
    #import <Accounts/ACAccount.h>
    
    @end
    

    This generates errors about the content in the file being imported (e.g. your illegal interface qualifier error), while the actual issue is that putting #import statements within an @interface block is invalid.

    You should put #import statements together at the top of the file, outside of any @interface or @implementation blocks.

    If you put it into the @implementation section, the error becomes:

    error: Objective-C declarations may only appear in global scope