【发布时间】:2017-12-19 06:10:00
【问题描述】:
在我的项目中,我使用了来自 ReactiveCocoa 的名为 keypath 的宏:
NSString *lowercaseStringPath = @keypath(NSString.new, lowercaseString);
// => @"lowercaseString"
* @endcode
*
* ... the macro returns an \c NSString containing all but the first path
* component or argument (e.g., @"lowercaseString.UTF8String", @"version").
*
* In addition to simply creating a key path, this macro ensures that the key
* path is valid at compile-time (causing a syntax error if not), and supports
* refactoring, such that changing the name of the property will also update any
* uses of \@keypath.
*/
#define keypath(...) \
metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__))(keypath1(__VA_ARGS__))(keypath2(__VA_ARGS__))
#define keypath1(PATH) \
(((void)(NO && ((void)PATH, NO)), strchr(# PATH, '.') + 1))
#define keypath2(OBJ, PATH) \
(((void)(NO && ((void)OBJ.PATH, NO)), # PATH))
它适用于主要目标。但是当我尝试运行测试时,它向我显示了这个错误:
我看到this post
这与我项目中的问题非常相似。但仍然不同,没有有用的答案。 有谁知道如何解决它?因为我真的被困在这里,不知道该去哪里。
【问题讨论】:
-
TokenModel是否在测试目标和您的主要目标中? -
是的,当然,我已经包含了它。
标签: objective-c xcode xctest uitest