0
我已經coreData實體定義爲獲得在CoreData的ios表的只有少數性能swift3
在TTFinds
@nonobjc public class func fetchRequest() -> NSFetchRequest<TTFinds> {
return NSFetchRequest<TTFinds>(entityName: "TTFinds");
}
我試圖讓TTFinds列表as
let request: NSFetchRequest<TTFinds> = TTFinds.fetchRequest()
do {
let result = try appDel.persistentContainer.viewContext.fetch(request)
可以看出TTFinds獲取其父TTArea對象。不過,我只想得到幾列。假設只有name
和creationDate
。如何完成?
我已經試過
let request: NSFetchRequest<TTFinds> = TTFinds.fetchRequest()
request.propertiesToFetch = NSArray.init(objects: "name", "creationDate", "image", "latitude", "longitude",
"area.name") as? [Any];
然而area.name給出錯誤。
你會得到什麼錯誤? –
@MartinR錯誤提取請求,sigabrt –