0
我正面臨一個奇怪的情況。我試圖從核心數據打印我提取的數據,但這就是我得到的結果:NSAsynchronousFetchResult。核心數據顯示獲取數據問題
這是我的實體類:
import Foundation
import CoreData
@objc(Contact)
class Contact: NSManagedObject {
@NSManaged var name: String
@NSManaged var group: String
}
,這是我的同班同學獲取結果:
func fetchCategories() {
var context: NSManagedObjectContext = appDel.managedObjectContext!
var error: NSError?
let fetchRequest = NSFetchRequest(entityName: "Contact")
fetchRequest.fetchBatchSize = 20
fetchRequest.returnsObjectsAsFaults = false
let fetchedResults = context.executeRequest(fetchRequest, error: &error)
if let results = fetchedResults {
var fetchedData = [results]
for contents in fetchedData {
println(contents.name)
}
} else {
println("\(error)")
}
}
任何幫助將受到歡迎