iOS中的DBL_EPSILON问题

时间:2014-01-05 19:22:42

标签: ios xcode5 xctest

我正在使用它 -

我项目中的

#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )宏。

我在项目的.pch文件中声明了这个宏

当target是我的项目时它正在工作,但是当我尝试使用xctest运行测试用例时却没有。

构建总是因以下错误而失败 - undeclared identifier 'DBL_EPSILON'

我已经在appName.pch中声明了这个并将.pch导入我的文本案例包.pch

导入#import <float.h>时。

这解决了我的问题。 我的问题为什么在测试包中需要这个导入?因为在主项目中不需要。

1 个答案:

答案 0 :(得分:0)

在顶部的.pch文件中导入float.h

#import<float.h>

#import <Foundation/Foundation.h>

#if TARGET_OS_IPHONE

#import <UIKit/UIKit.h>