我正试图在swift 3中使用魔法记录。我对Swift很新,因为我过去一直在使用objc,所以当我做以下操作时我会收到此错误:
var inAppPackageResultsController: NSFetchedResultsController<NSFetchRequestResult>{
return InAppPackage.mr_fetchAllSorted(by:"order", ascending: true, with: packagePredicate, groupBy: "name", delegate: self)
}
func returnInfo (type: String, index: IndexPath) -> String {
print("\(inAppPackageResultsController.fetchedObjects.count)")
let package = inAppPackageResultsController.object(at: index) as! InAppPackage
当我调用returnInfo函数时,我得到索引1错误的no对象,但是fetchedObjects的计数是5。