3
這裏是我的DBManager.swift領域的iOS:無法將類型的價值 'Dogs.Type' 預期參數類型 'T.Type'
import RealmSwift
class DBManager {
class func getAllDogs() -> [Dog] {
let realm = try! Realm()
// COMPILER ERROR: Cannot Convert value of type 'Dogs.Type' to expected argument type 'T.Type'
return realm.objects(Dog.self)
}
}
這是我Dog.swift:
import Foundation
import RealmSwift
class Dog: Object {
dynamic var firstName = ""
dynamic var lastName = ""
dynamic var dateOfBirth = ""
dynamic var lastFourSsn = ""
dynamic var currentLocation = ""
dynamic var dog: NSData!
}
我得到這個編譯器錯誤:
Cannot Convert value of type 'Dogs.Type' to expected argument type 'T.Type'
好像我真的缺少基本的東西在這裏 - 因爲這是大部分代碼directl y從RealmSwift documentation。我究竟做錯了什麼?
Stackoverflow上這樣聰明的人 – etayluz