I'm trying to have an enum as part of my method signature and I get this hideous error in my .h file:
Declaration of 'enum CacheFile' will not be visible outside this function
I have this in my h file :
 @interface DAO : NSObject
    typedef enum {
        DEFAULT_CACHE_FILE,
        WEB_CACHE_FILE
    } CacheFile;
    -(NSMutableArray *) parseFile :(enum CacheFile) file;
@end
My .m file :
-(NSMutableArray *) parseFile:(CacheFile) file{
.....
....
}
And I get this warning in my m file :
Conflicting Parameter types in implementation of 'parseFile:':'enum CacheFile' vs 'CacheFile'
What am I doing wrong ?
Move the enum declaration outside of the @interface, update it to proper Objective-C enum idiom (separate typedef) and fix the method declaration:
enum {
   DEFAULT_CACHE_FILE,
   WEB_CACHE_FILE
};
typedef unsigned long CacheFile;
@interface DAO : NSObject    
   -(NSMutableArray *) parseFile:(CacheFile) file;
@end
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With