2016-11-21 52 views
2

我遇到了一組神祕鏈接器錯誤。我的常規目標和UITest目標生成並執行正常,但UnitTest目標總是失敗,並顯示下面的錯誤。似乎是CoreData的一些問題,但我不明白爲什麼它在測試目標上的錯誤,而不是在主要目標上。我試過了: 1)清除導出的數據。 2)重新啓動xCode 3)乾淨的安裝莢Xcode 8 UITests「直接字段偏移」的構建錯誤

任何有關在哪裏尋找問題的幫助將不勝感激。我很難過。謝謝!

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) 
+0

嘗試:http://stackoverflow.com/questions/9458739/ld-warning-directory-not-found-for-option – shallowThought

回答

6

通過審閱我的承諾項目,通過項目,我跟蹤它到一個SWIFT_WHOLE_MODULE_OPTIMIZATION標誌。從項目中刪除此設置修復了它。我不知道爲什麼,但我想我會離開這個以防萬一有人幫助。

+0

由於優化有更多的檢查需要,它可以檢測到不會出現沒有它。 因此,基本上這些代碼有bug,可能會導致發佈應用程序出現意外的行爲 –