【发布时间】:2015-12-25 15:03:02
【问题描述】:
我正在尝试在我的 ios9 项目上使用 parse 进行 follow action,但是在从 PFUser 检索时遇到了一点问题使用 objectId 解析,谁能帮帮我(问题在于将当前用户的用户 ID 添加到关注的用户)
- (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];
}
【问题讨论】:
-
您遇到的具体问题是什么?
-
在关注者案例中添加当前用户 ID 时,我收到警告警告:正在主线程上执行长时间运行的操作。中断 warnBlockingOperationOnMainThread() 进行调试。
标签: ios objective-c parse-platform pfuser