I am using Appirater (https://github.com/arashpayan/appirater) to enable app ratings in my xcode project. Everything builds OK when using 'iOS Simulator' but when I use the 'iOS device' target to archive my project I get 2 build errors:
Semantic Issue: Implicit declaration of function 'SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO' is invalid in C99
Semantic Issue: Implicit declaration of function 'SYSTEM_VERSION_LESS_THAN' is invalid in C99
The relevant lines of code are in the Appirater.m file:
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0") && SYSTEM_VERSION_LESS_THAN(@"7.1")) {
reviewURL = [templateReviewURLiOS7 stringByReplacingOccurrencesOfString:@"APP_ID" withString:[NSString stringWithFormat:@"%@", _appId]];
}
I found a set of macros that are very similar to these in How to check iOS version?
Any assistance would be appreciated.
In C90, if a function is called without an explicit declaration, the compiler is going to complain about the implicit declaration. Here is a small code that will give us an Implicit declaration of function error.
From C89, Section 3.3.2.2: If the expression that precedes the parenthesized argument list in a function call consists solely of an identifier, and if no declaration is visible for this identifier, the identifier is implicitly declared exactly as if, in the innermost block containing the function call, the declaration appeared.
In C90, if a function is called without an explicit declaration, the compiler is going to complain about the implicit declaration. Here is a small code that will give us an Implicit declaration of function error. Now the above code will give you an error of Implicit declaration.
In the case of C99, you can skip the declaration but it will give us a small warning and it can be ignored but the definition of the function is important. This gives us the output:
Add these lines from your link to your .pch file. Clean and build. It should go away.
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
More info: since the preprocessor cannot find them to do a find and replace for these macros, they pass through to the compiler where they look like C functions. The compiler cannot find them and gives you an error.
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