gpt4 book ai didi

objective-c - OCMock - 试图模拟 NSEntityDescription

转载 作者:行者123 更新时间:2023-11-28 18:25:42 26 4
gpt4 key购买 nike

为了测试托管类,我尝试通过首先尝试模拟 NSEntityDescription 和 NSManagedObjectContext 在单元测试中创建一个实例。

id mockEntityDesc = [OCMockObject niceMockForClass:[NSEntityDescription class]];
id mockManagedObjectContext = [OCMockObject mockForClass:NSManagedObjectContext.class];

但是在我进一步了解之前,我在运行测试时收到以下错误;

Undefined symbols for architecture i386: "_OBJC_CLASS_$_NSEntityDescription", referenced from: objc-class-ref in CallsCoordinatorTests.o "_OBJC_CLASS_$_NSManagedObjectContext", referenced from: objc-class-ref in CallsCoordinatorTests.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

有什么建议吗?谢谢

最佳答案

您的单元测试目标未与核心数据框架链接。

关于objective-c - OCMock - 试图模拟 NSEntityDescription,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10028721/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com