Xcode 8 UITests的生成错误“;“直接字段偏移量”;

Xcode 8 UITests的生成错误“;“直接字段偏移量”;,xcode,linker-errors,xcode8,Xcode,Linker Errors,Xcode8,我遇到了一系列神秘的链接器错误。我的常规目标和UITest目标构建和执行良好,但UnitTest目标总是失败,并出现以下错误。CoreData似乎存在某种问题,但我不明白为什么它会在测试目标上出错,而不是在主目标上出错。 我试过: 1) 清除派生数据。 2) 重新启动xCode 3) 清洁安装吊舱 任何关于在哪里寻找问题的帮助都将不胜感激。我被难住了。谢谢 Undefined symbols for architecture x86_64: "direct field offset for

我遇到了一系列神秘的链接器错误。我的常规目标和UITest目标构建和执行良好,但UnitTest目标总是失败,并出现以下错误。CoreData似乎存在某种问题,但我不明白为什么它会在测试目标上出错,而不是在主目标上出错。 我试过: 1) 清除派生数据。 2) 重新启动xCode 3) 清洁安装吊舱

任何关于在哪里寻找问题的帮助都将不胜感激。我被难住了。谢谢

Undefined symbols for architecture x86_64:
  "direct field offset for playolaIphone.AppDelegate.(managedObjectModel.storage in _D550B33DB84959D9A74FD87E48EB7BC7) : __ObjC.NSManagedObjectModel?", referenced from:
      playolaIphone.AppDelegate.managedObjectModel.setter : __ObjC.NSManagedObjectModel in MockAppDelegate.o
      playolaIphone.AppDelegate.(managedObjectModel.materializeForSet : __ObjC.NSManagedObjectModel).(closure #1) in MockAppDelegate.o
  "direct field offset for playolaIphone.AppDelegate.(managedObjectContext.storage in _D550B33DB84959D9A74FD87E48EB7BC7) : __ObjC.NSManagedObjectContext?", referenced from:
      playolaIphone.AppDelegate.managedObjectContext.setter : __ObjC.NSManagedObjectContext in MockAppDelegate.o
      playolaIphone.AppDelegate.(managedObjectContext.materializeForSet : __ObjC.NSManagedObjectContext).(closure #1) in MockAppDelegate.o
  "direct field offset for playolaIphone.AppDelegate.(persistentStoreCoordinator.storage in _D550B33DB84959D9A74FD87E48EB7BC7) : __ObjC.NSPersistentStoreCoordinator?", referenced from:
      playolaIphone.AppDelegate.persistentStoreCoordinator.setter : __ObjC.NSPersistentStoreCoordinator in MockAppDelegate.o
      playolaIphone.AppDelegate.(persistentStoreCoordinator.materializeForSet : __ObjC.NSPersistentStoreCoordinator).(closure #1) in MockAppDelegate.o
  "direct field offset for playolaIphone.AppDelegate.(applicationDocumentsDirectory.storage in _D550B33DB84959D9A74FD87E48EB7BC7) : Foundation.URL?", referenced from:
      playolaIphone.AppDelegate.applicationDocumentsDirectory.setter : Foundation.URL in MockAppDelegate.o
      playolaIphone.AppDelegate.(applicationDocumentsDirectory.materializeForSet : Foundation.URL).(closure #1) in MockAppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

通过逐项检查我的提交,我找到了一个SWIFT\u整体\u模块\u优化标志。从项目中删除此设置可以修复它。我不知道为什么,但我想我会保留这个,以防它对某人有所帮助。

尝试:由于优化,需要更多的检查,可以检测没有它不会出现的问题。因此,基本上代码中有可能导致发布应用程序出现意外行为的bug