iOS中的DBL_EPSILON问题

rtk*_*123 10 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>.

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

Mil*_*lia 0

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

#import<float.h>

#import <Foundation/Foundation.h>

#if TARGET_OS_IPHONE

#import <UIKit/UIKit.h>
Run Code Online (Sandbox Code Playgroud)