callFunctionInBackground解析swift

时间:2015-11-17 20:56:41

标签: ios swift parse-platform

我使用以下代码:

PFCloud.callFunctionInBackground("getFollowers", withParameters: ["userId":id!,"offset":0 ]) { (result , error) -> Void in

        if let result = result as? [Follower]  {
            print(result)
            for fl in result {

                print(fl)
            }
        }
    }
}

print(result)显示以下内容:

[<Follower: 0x7f8f7253c2f0, objectId: 5h3pcK0GTK, localId: (null)> {
Likes = 2;
description = cggggg;
image = "<PFFile: 0x7f8f7253b220>";
isFollowing = 0;
pushed = 1;
user = "<Spoke.SPKUser: 0x7f8f72564690, objectId: ESczJnhc7c, localId: (null)>";
voice = "<PFFile: 0x7f8f7253e8e0>";}]

奇怪的是print(fl)显示:

fl  myapp.Follower  0x00007fe0c1e6aa90  0x00007fe0c1e6aa90
Parse.PFObject  PFObject        
Likes   Int!    nil
image   PFFile! nil 
isFollowing Bool!   nil 
pushed  Bool!   nil 
user    Spoke.SPKUser!  nil 
voice   PFFile! nil

我的问题是为什么我无法获得映射的跟随对象数组?

1 个答案:

答案 0 :(得分:0)

我刚刚在@NSManaged子类的每个属性前添加了PFObject并且它有效