2016-11-21 2 views
2

ミステリーリンカエラーが発生しました。私の通常のターゲットとUITestターゲットはうまく構築され実行されますが、UnitTestターゲットは常に以下のエラーで失敗します。 CoreDataに何らかの問題があるように見えますが、主なターゲットではなくテストターゲットでエラーが発生する理由を理解できません。 私は試しました: 1)派生データをクリアします。 2)xCodeを再起動します 3)ポッドのクリーンインストールXcode 8のビルドエラーUITests "direct field offset"

問題を探すための助けがあれば幸いです。私は困惑している。ありがとう!私の項目別のコミットを経て

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

最適化のために、より多くのチェックが必要です。それ。 基本的にコードにはバグがあり、リリースアプリの予期しない動作につながる可能性があります –