通过didSelectRowAtIndexPath传递数据,在详细视图中显示时出现崩溃错误?

时间:2016-04-14 22:08:23

标签: ios objective-c

我通过didSelectRowAtIndexPath(特别是三个值:用户名,生物和照片)将数据传递给我的详细视图控制器。

数据成功传递给我的NSDictionary,neigbourDetail,但是当我尝试在标签(OtherUserViewController)的详细视图中显示它时,此行会导致崩溃错误:

OtherUserViewController.m

self.username.text = [[neighbourDetail objectForKey:@"users_name"] objectAtIndex:0];

崩溃错误是:

  

由于未捕获的异常而终止应用   'NSInvalidArgumentException',原因:' - [NSTaggedPointerString   objectForKey:]:发送到实例的无法识别的选择器   0xa00bc50441082e58'

我似乎无法理清原因。请参阅下面的初始视图,以及在OtherUserViewController(详细视图)中返回的数据。我应该如何编写崩溃线呢?

ViewController.m

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    OtherUserViewController *vc = [sb instantiateViewControllerWithIdentifier:@"OtherUserViewController"];

     vc.neighbourDetail= self.neighbourData[indexPath.row][@"userbio"];
     vc.neighbourDetail= self.neighbourData[indexPath.row][@"photo_path"];
     vc.neighbourDetail= self.neighbourData[indexPath.row][@"users_name"];


    UINavigationController* navController = (UINavigationController*)self.revealViewController.frontViewController;
    [navController setViewControllers: @[vc] animated: YES];

    [self.revealViewController setFrontViewPosition: FrontViewPositionLeft animated: YES];

}

返回的数据

2016-04-14 14:59:30.877 myapp[5396:1739868] This is the neighbourdata (
        {
        address = "Address is here";
        "photo_path" = "http://url.com/default/files/stored/1459887925.jpg";
        "profile photo" = "<img typeof=\"foaf:Image\" src=\"http://url.com/default/files/stored/1459887925.jpg\" width=\"750\" height=\"732\" alt=\"\" />";
        uid = 47;
        userbio = "Hi my name is Blair";
        "users_name" = Blair;
    },

0 个答案:

没有答案