将PFObject值从字符串移动到带有计数器的数组



我正在使用ParseUI查询和PFQueryTableViewControllers。我有一个PFQuerytable ViewController需要传递PFObject的值。objectId到另一个PFQUeryTableViewController。要做到这一点,我需要将该值放入prepareforseque方法中。我一直在尝试将其添加到数组中,以便在准备序列时,我可以使用IndexPath检索正确的值并将其添加到接收TVC上的属性。

然而,虽然我可以得到值从对象(PFObject)成一个字符串,当我尝试简单地移动该值到数组元素,使用计数器,结果是一个nil值在数组中。我一直在检查文档和在线等,并没有能够找到为什么我的数组"objectIdArray"不接受语句

中objectIdString的值
objectIdArray [i] = objectIdString;
@implementation LinesTableViewController

NSMutableArray *objectIdArray = nil;
int i = 0;
NSString *objectIdString = nil;

then inside method: cellForRowAtIndexPath
- (UITableViewCell *)tableView:(UITableView *)tableView
         cellForRowAtIndexPath:(NSIndexPath *)indexPath
                        object:(PFObject *)object {
    static NSString *cellIdentifier = @"linesCell";
    
    PFTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (!cell) {
        cell = [[PFTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
                                      reuseIdentifier:cellIdentifier];}
    
    // Configure the cell
    
    cell.textLabel.text = object[@"name"];
    cell.detailTextLabel.text = [NSString stringWithFormat:@"Awesomness: %@ ",     object[@"rating"]];
    objectIdString = object.objectId;
    NSLog(@" heres the string %@", objectIdString);
    objectIdArray [i] = objectIdString;
    NSLog(@" heres the array %@", objectIdArray);
    i++;
objectIdArray = [[NSMutableArray alloc] init];

最新更新