1
我試圖通過進入編輯菜單創建nsmanagedobject(用戶),然後選擇創建NSManagedObject子類......這會產生四個文件:創建NSManagedObject子導致鏈接錯誤重複的符號
User+CoreDataClass.h
User+CoreDataClass.m
User+CoreDataProperties.h
User+CoreDataProperties.m
在我viewcontrollers之一,我輸入用戶+ CoreDataClass.h再有這樣的代碼:
//create new account entity
User* thisUser = [NSEntityDescription
insertNewObjectForEntityForName:@"User"
inManagedObjectContext:self.myController.myDataManager.managedObjectContext];
當我再構建應用程序,我收到以下錯誤鏗鏘:
duplicate symbol _OBJC_CLASS_$_User in:
/Users/xxxxxxxxxxxx/Library/Developer/Xcode/DerivedData/StarDate-fzkjccyoiwhfvvczdwkvkmtbioqw/Build/Intermediates/StarDate.build/Debug-iphonesimulator/StarDate.build/Objects-normal/x86_64/User+CoreDataClass.o
duplicate symbol _OBJC_METACLASS_$_User in:
/Users/xxxxxxxxxxxx/Library/Developer/Xcode/DerivedData/StarDate-fzkjccyoiwhfvvczdwkvkmtbioqw/Build/Intermediates/StarDate.build/Debug-iphonesimulator/StarDate.build/Objects-normal/x86_64/User+CoreDataClass.o
ld: 2 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我嘗試清理應用程序並刪除我的派生數據,但沒有結果。我可以清除錯誤的唯一方法是刪除生成的文件。這顯然不會是我所需要的。爲什麼XCode從這個菜單命令創建重複文件?有沒有我錯過的設置?
感謝
謝謝,我其實只是在另一個線程中閱讀解決方案。儘管你給了你一個凹凸。 :) – PruitIgoe