简体   繁体   中英

Semantic Issue - implicit declaration of function

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM