0

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!

Lucia Belardinelli
  • 727
  • 1
  • 11
  • 20
  • If That's a copy-paste from the header file then it indicates that the file has been corrupted in some way - the first line that you have an error on should read: `@class ACAccountType, ACAccountCredential;` - i.e. a forward class declaration. – Anya Shenanigans Oct 02 '14 at 09:29
  • yes it's a copy paste error.. the ";" is in the line.. Question corrected – Lucia Belardinelli Oct 02 '14 at 11:02
  • Show some of the file that is performing the `#import` of `ACAccount.h` - it reads like you're putting the `#import` inside an `@interface foo ()` `@end` block. Import statements are best placed at the top of the file outside any `@` sections. – Anya Shenanigans Oct 02 '14 at 11:45
  • please write this as answer so I can accept it :) – Lucia Belardinelli Oct 07 '14 at 13:35

1 Answers1

0

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

Anya Shenanigans
  • 91,618
  • 3
  • 107
  • 122