我检查了表的权限,所有的读、写、修改权限都是允许所有用户的,所以看起来不像权限问题
我的AppID是BvcgkxdRDlts836i0xKiFFxr-gzGzoHsz
以 AVUser.current()?.getFollowers (获取当前用户所关注的列表)方法为例,
AVUser.current()?.getFollowers{(followers:[Any]?,error:Error?) in
if error == nil && followers != nil {
self.followerArray = followers! as! [AVUser]
self.tableView.reloadData()
} else {
print(error?.localizedDescription)
}
}
执行后可以看到日志信息如下:
2020-06-13 22:22:11.215707+0800 MyInstegram[64506:4216391] [DEBUG] -[AVPaasClient performRequest:success:failure:wait:] [Line 609]
------ BEGIN LeanCloud REST Request -------
path: /1.1/classes/_Follower
curl: curl -i -k -X GET -G --compressed -H 'Accept: application/json' -H 'Content-Type: application/json; charset=utf-8' -H 'X-LC-Id: BvcgkxdRDlts836i0xKiFFxr-gzGzoHsz' -H 'X-LC-Prod: 1' -H 'Accept-Language: en;q=1' -H 'X-LC-Session: ykskv7gktvebu7jrv6x9o6e4r' -H 'Accept-Encoding: gzip' -H 'User-Agent: AVOS Cloud iOS-v7.3.1 SDK' --data-urlencode 'include=follower' --data-urlencode 'keys=follower' --data-urlencode 'where={"$and":[{"user":{"_type":"Pointer","className":"User","objectId":"5ec394973522a50006d6d266"}}]}' "https://BvcgkxdR.api.lncld.net/1.1/classes/_Follower"
------ END --------------------------------
2020-06-13 22:22:16.910238+0800 MyInstegram[64506:4216536] [DEBUG] -[AVPaasClient performRequest:success:failure:wait:]blockinvoke [Line 652]
------ BEGIN LeanCloud REST Response ------
path: /1.1/classes/_Follower
cost: 5694.303ms
response: {
results = (
);
}
------ END --------------------------------
(lldb)
返回的response中的results是没有任何数据的,但是在控制台中可以看到_Follower里应该有三条数据。
但是如果调用 AVUser.current()?.getFollowees (同时获取当前用户的粉丝和关注列表),
AVUser.current()?.getFollowees{(followers:[Any]?,error:Error?) in
if error == nil && followers != nil {
self.followerArray = followers! as! [AVUser]
self.tableView.reloadData()
} else {
print(error?.localizedDescription)
}
}
执行后就可以看到日志如下:
2020-06-13 22:25:30.419853+0800 MyInstegram[64506:4216391] [DEBUG] -[AVPaasClient performRequest:success:failure:wait:] [Line 609]
------ BEGIN LeanCloud REST Request -------
path: /1.1/classes/_Followee
curl: curl -i -k -X GET -G --compressed -H 'Accept: application/json' -H 'Content-Type: application/json; charset=utf-8' -H 'X-LC-Id: BvcgkxdRDlts836i0xKiFFxr-gzGzoHsz' -H 'X-LC-Prod: 1' -H 'Accept-Language: en;q=1' -H 'X-LC-Session: ykskv7gktvebu7jrv6x9o6e4r' -H 'Accept-Encoding: gzip' -H 'User-Agent: AVOS Cloud iOS-v7.3.1 SDK' --data-urlencode 'include=followee' --data-urlencode 'keys=followee' --data-urlencode 'where={"$and":[{"user":{"_type":"Pointer","className":"User","objectId":"5ec394973522a50006d6d266"}}]}' "https://BvcgkxdR.api.lncld.net/1.1/classes/_Followee"
------ END --------------------------------
2020-06-13 22:25:32.245397+0800 MyInstegram[64506:4218055] [DEBUG] -[AVPaasClient performRequest:success:failure:wait:]blockinvoke [Line 652]
------ BEGIN LeanCloud REST Response ------
path: /1.1/classes/_Followee
cost: 91.863ms
response: {
results = (
{
createdAt = "2020-06-09T05:54:50.667Z";
followee = {
"__type" = Pointer;
ava = {
"__type" = File;
bucket = BvcgkxdR;
createdAt = "2020-06-05T08:37:08.597Z";
key = "jvuEEaDvjVIgWCnC4uQrPNC.jpg";
metaData = {
"_checksum" = 9531fc8f6cf680f934bb9a244a73d608;
size = 242290;
};
"mime_type" = "image/jpeg";
name = "ava.jpg";
objectId = 5eda0434ba7dda00094ce587;
provider = qiniu;
updatedAt = "2020-06-05T08:37:08.597Z";
url = "http://lc-BvcgkxdR.cn-n1.lcfile.com/jvuEEaDvjVIgWCnC4uQrPNC.jpg";
};
className = "_User";
createdAt = "2020-06-05T08:37:09.039Z";
email = "zhangdan@sina.com";
emailVerified = 0;
fullname = zhangdan;
mobilePhoneVerified = 0;
objectId = 5eda04359cf15200063a238e;
updatedAt = "2020-06-05T08:37:09.039Z";
userinfo = mummy;
username = mom;
web = "www.iseeku.com";
};
objectId = 5edf242a3e8c5e000880f595;
updatedAt = "2020-06-09T05:54:50.667Z";
},
{
createdAt = "2020-06-09T05:58:23.083Z";
followee = {
"__type" = Pointer;
ava = {
"__type" = File;
bucket = BvcgkxdR;
createdAt = "2020-06-05T08:04:51.703Z";
key = "vV9zmRHSCmcHWHJfgevtBVD.jpg";
metaData = {
"_checksum" = 090d118c2d77e93a7bb3658076ddced2;
size = 124300;
};
"mime_type" = "image/jpeg";
name = "ava.jpg";
objectId = 5ed9fca3c14134000661c33e;
provider = qiniu;
updatedAt = "2020-06-05T08:04:51.703Z";
url = "http://lc-BvcgkxdR.cn-n1.lcfile.com/vV9zmRHSCmcHWHJfgevtBVD.jpg";
};
className = "_User";
createdAt = "2020-06-05T08:04:52.164Z";
email = "drgao1946@sina.com";
emailVerified = 0;
fullname = "gap urban";
mobilePhoneVerified = 0;
objectId = 5ed9fca4c14134000661c33f;
updatedAt = "2020-06-05T08:04:52.164Z";
userinfo = Grandpa;
username = DrGao;
web = "www.iseeku.com";
};
objectId = 5edf24ff9d7c3a0006ffda21;
updatedAt = "2020-06-09T05:58:23.083Z";
}
);
}
------ END --------------------------------
提交返回的response的results就有数据,和_Followee中查询到的结果也是一致的
这个可能是什么原因呢?