首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >解析跟随PFUser

解析跟随PFUser
EN

Stack Overflow用户
提问于 2015-12-25 15:03:02
回答 1查看 106关注 0票数 0

我试图在我的ios9项目上使用解析执行一个跟踪操作,但是当从使用objectId的解析中撤回PFUser时,有人能帮我吗(问题是在将当前用户的用户ID添加到所跟踪的用户中)

代码语言:javascript
复制
- (IBAction)followButtonAction:(id)sender {

PFQuery * query = [PFUser query];
[query whereKey:@"objectId" equalTo:_a.userId];   
NSArray *objects = [query findObjects];   
PFUser *user= objects.firstObject;

//add the user ID for the cell we are following to the array of followed items in the user class in parse
    [[PFUser currentUser] addUniqueObject:_a.userId forKey:@"followed"];
    [[PFUser currentUser] saveInBackground];

//add the user ID to the user that the user followed
    [user addUniqueObject:[PFUser currentUser].objectId forKey:@"followers"];
    [user saveInBackground];
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-12-25 21:20:50

假设您的问题是关于长期运行的操作(根据您的评论):

您的查询正在主线程上执行,因为您调用了[query findObjects]。相反,使用findObjectsInBackgroundWithBlock,然后将所有代码放在回调中。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34463896

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档