我正在使用Appirater(https://github.com/arashpayan/appirater)在我的xcode项目中启用应用评分。使用' iOS模拟器'但是当我使用' iOS设备'目标是存档我的项目我得到2个构建错误:
语义问题:隐含的函数声明&#SYSTEM; OFVERSION_GREATER_THAN_OR_EQUAL_TO'在C99中无效
语义问题:函数的隐式声明' SYSTEM_VERSION_LESS_THAN'在C99中无效
相关的代码行位于Appirater.m文件中:
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]];
}
我发现了一组与How to check iOS version?
中非常类似的宏任何帮助都将不胜感激。
答案 0 :(得分:5)
将链接中的这些行添加到.pch文件中。清洁和建造。它应该消失。
#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)
更多信息:由于预处理器无法找到它们来查找和替换这些宏,因此它们会传递到编译器,它们看起来像C函数。编译器找不到它们并给你一个错误。
答案 1 :(得分:1)
<强>更新强> 请从回购再次拉出来。这应该有效。对不起。
原始回复 这是我的错。在没有构建/测试的情况下,我通过这些宏调用接受了对Appirater仓库的新更改。我现在正在删除有问题的宏,并会在一小时内推出修复程序。