简体   繁体   中英

'type' is not a member type of 'T'

Getting compiler error on declaration: type: T.type :

'type' is not a member type of 'T'

public class ParseRealmSync {

    public static func synchronize <T: Model> (type: T.type){
        var allObjects = [type]()
        var limit = 0
        var skip = 0
        var query = PFQuery(className: T.parseClassName(), predicate: nil)
        query.limit = limit
        query.skip = skip

        query.findObjectsInBackgroundWithBlock { (objects, error) -> Void in
            println(objects)
        }
    }
}

Why?

It should be T.Type instead of T.type .

Also

var allObjects: [T] = []

instead of

var allObjects = [type]()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM