Semantic Issue - implicit declaration of function

3.4k views Asked by At

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.

2

There are 2 answers

0
rob5408 On

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.

0
Arash Payan On

UPDATE Please pull again from the repo. This should be working. Sorry about that.

ORIGINAL RESPONSE This is my fault. I accepted a new change with these macro calls into the Appirater repo without building/testing. I'm removing the offending macros now and will push a fix within the hour.