"Generic parameter 'ResultType' could not be inferred" while use NSFetchRequest() with swift 3.0
core-data, ios, nsfetchrequest, swift
Solution
It should be like
let fetchRequest:NSFetchRequest<Book> = Book.fetchRequest()
And your Book+CoreDataProperties.swift file for Swift 3 will be like this
import Foundation
import CoreData
extension Book {
@nonobjc public class func fetchRequest() -> NSFetchRequest<Book> {
return NSFetchRequest<Book>(entityName: "Book");
}
@NSManaged public var bookName: String?
}
Problem
While I convert my project to swift 3.0 , I found that error parameter 'ResultType' could not be inferred My code like this : ``` let fetchRequest = NSFetchRequest(entityName: "Book") ``` I use this code in my project before,and now it appears error.How shell I modify it right.