Semantic Problem - Implicit Function Declaration

I am using Appirater ( https://github.com/arashpayan/appirater ) to enable application ratings in my xcode project. Everything works fine when using the "iOS Simulator", but when I use the target of the iOS device to archive my project, I get 2 build errors:

Semantic problem: implicit declaration of function 'SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO' is invalid in C99

Semantic problem: implicit declaration of function 'SYSTEM_VERSION_LESS_THAN' is invalid in C99

The corresponding 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 them in How to check the iOS version?

Any help would be appreciated.

+4
source share
2 answers

Add these lines from your link to your .pch file. Clean and build. He must leave.

#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)

Additional information: since the preprocessor cannot find them to find and replace these macros, they pass to the compiler where they look like functions of C. The compiler cannot find them and gives an error.

+4
source

UPDATE Retry from repo. That should work. Excuse me.

ORIGINAL ANSWER This is my mistake. I accepted a new change with these macro calls to the Appirater repository without creating / testing. Now I delete the offensive macros and press the fix for an hour.

+1
source

Source: https://habr.com/ru/post/1541694/


All Articles