我正在运行一个没有问题的查询,这是我的代码:
PFQuery *postQuery = [PFQuery queryWithClassName:@"class"];
[postQuery whereKey:@"hasRelationship" equalTo:[PFUser currentUser]];
// Run the query
[postQuery findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
//Save results and update the table
group = [objects valueForKey:@"groupArray"];
}
}
结果不错,组控制台打印如下:
(
("Register one",
"Register two",
"Register three",
"Register four")
)
但是我需要一个长度为 4 而不是 1 的数组。每次我通过将结果传递到 NSString“可变副本”中来剥离结果,就像这样崩溃:
( NSString *s = (NSString *)[group objectAtIndex:0];
NSString * text = (NSString *)[s mutableCopy];)
这是错误:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM stringByReplacingOccurrencesOfString:withString:]: unrecognized selector sent ***
如何将对象内的元素变成NSArray
长度为 4 的元素?谢谢!