问题
I have an array of ids. I want to fetch core data entity for the items in the ids array. How can we implement that using NSFetchRequest
?
回答1:
Use NSPredicate
fetchRequest.predicate = NSPredicate(format: "itemId IN %@", itemIds)
Instead of itemId
set your actual id property name. Now perform a fetch with this fetch request
回答2:
let hrData = self.cstProjectDetails as NSArray
来源:https://stackoverflow.com/questions/51264432/how-to-fetch-array-of-objects-using-array-of-ids-using-core-data