Ios 使用Parse.com获取警告
我正在尝试通过enumerateObjectsUsingBlock访问NSArray上的每个项,因为它允许我使用快速枚举和评估索引 当我使用findObjectsInBackgroundWithBlock时 我收到警告:正在主服务器上执行长时间运行的操作 线。断开警告BlockingOperationMainThread()以进行调试 正如我所认为的那样,它在后台用于不阻塞主线程。这是我的代码,我正在尝试实现它,我有两个UIImageView容器,我正在从该查询的关系结果中提取图像。因为我认为只有一个容器,所以最好只评估NSArray的指数 我不知道我怎样才能纠正那个警告 谢谢Ios 使用Parse.com获取警告,ios,objective-c,parse-platform,cell,fast-enumeration,Ios,Objective C,Parse Platform,Cell,Fast Enumeration,我正在尝试通过enumerateObjectsUsingBlock访问NSArray上的每个项,因为它允许我使用快速枚举和评估索引 当我使用findObjectsInBackgroundWithBlock时 我收到警告:正在主服务器上执行长时间运行的操作 线。断开警告BlockingOperationMainThread()以进行调试 正如我所认为的那样,它在后台用于不阻塞主线程。这是我的代码,我正在尝试实现它,我有两个UIImageView容器,我正在从该查询的关系结果中提取图像。因为我认为只
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (objects != 0) {
[objects enumerateObjectsUsingBlock:^(PFUser *object, NSUInteger idx, BOOL *stop) {
if (idx == 0) {
PFFile *userProfile = [object objectForKey:@"userPic"];
cell.promoter1.file = userProfile;
cell.promoter1.contentMode = UIViewContentModeScaleAspectFit;
[cell.promoter1 loadInBackground];
cell.promoter1Name.textAlignment = NSTextAlignmentCenter;
cell.promoter1Name.lineBreakMode = NSLineBreakByWordWrapping;
}
if (idx == 1) {
PFFile *userProfile = [object objectForKey:@"userPic"];
cell.promoter2.file = userProfile;
cell.promoter2.contentMode = UIViewContentModeScaleAspectFit;
[cell.promoter2 loadInBackground];
NSAttributedString *promoter1Name;
cell.promoter2Name.textAlignment = NSTextAlignmentCenter;
*stop = YES;
}
}];
}
}];
对代码进行故障排除后,我意识到
findobjectsinbackgroundithblock
不会导致此警告
在我的代码的另一部分,我有这样一句话:
PFUser *user = [PFQuery getUserObjectWithId:@"ebwFrl8PcF"];
[relation addObject:user];
[self.event saveInBackground];
它阻塞了主线程
我道歉