Parse.com-如何搜索/检索当前用户的安全对象 [英] Parse.com - How to search/retrieve secured object for current uer

查看:80
本文介绍了Parse.com-如何搜索/检索当前用户的安全对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据解析API文档其他对象的安全性".

As per parse API documentation, "Security For Other Objects".

创建只能由当前用户访问的私人注释:

Create a private note that can only be accessed by the current user:

PFObject *privateNote = [PFObject objectWithClassName:@"Note"];
privateNote[@"content"] = @"This note is private!";
privateNote.ACL = [PFACL ACLWithUser:[PFUser currentUser]];
[privateNote saveInBackground];

链接: https://www.parse.com/docs/ios_guide# users-acls/iOS

此注释将仅对当前用户可用,尽管该用户登录的任何设备都可以访问.

This note will then only be accessible to the current user, although it will be accessible to any device where that user is signed in.

问题:如何检索我所有的私人笔记?无法在文档中找到.

Question: How to retrieve all my private notes ? Unable to find out in documentation.

推荐答案

实际上,我还有另一个简单的解决方案:

Actually I've got another simple solution:

无需创建额外的列.您可以简单地使用:

NO need to create extra column. You can simply use this:

PFObject *privateNote = [PFObject objectWithClassName:@"Note"];
privateNote[@"content"] = @"This note is private!";
privateNote.ACL = [PFACL ACLWithUser:[PFUser currentUser]];
[privateNote saveInBackground];


PFQuery *query = [PFQuery queryWithClassName:@"Note"];
NSArray *usersNote = [query findObjects];
NSLog(@"%@",usersNote);

它将自动检索私人笔记.

It will automatically retrieve private note.

这篇关于Parse.com-如何搜索/检索当前用户的安全对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆