从数据库字段中检索数据,以 NSException 类型的未捕获异常终止?

Retrieving data from database field, terminating with uncaught exception of type NSException?

我正在使用以下代码从我的数据库中检索数据 (thirdLink):

    NSMutableDictionary *viewParamsDogs = [NSMutableDictionary new];
    [viewParamsDogs setValue:@"mydogs" forKey:@"view_name"];
    [DIOSView viewGet:viewParamsDogs success:^(AFHTTPRequestOperation *operation, id responseObject) {


        //DOG PHOTO


      self.dogData = [responseObject mutableCopy];

        NSDictionary *dic = [responseObject valueForKey: @"field_pet_photo_path"];
                             NSArray *arr = [dic valueForKey: @"und"];
                             NSDictionary *dic2= [arr objectAtIndex : 0];
                             NSString *path = [dic2 valueForKey: @"safe_value"];


    if([path length]>0) {

            NSString *ImageURL = path;
            NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:ImageURL]];

            self.dogimageView.image = [[UIImage alloc] initWithData:imageData];

        } else {

            NSString *ImageURL = @"paw.png";
            NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:ImageURL]];
            self.dogimageView.image = [UIImage imageWithData:imageData];
      }

  } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"Failure: %@", [error localizedDescription]);
    }];

填充了字段并返回了数据,但是这一行抛出了以下错误:

  NSString *thirdLink = responseObject[@"field_pet_photo_path"][@"und"][0][@"safe_value"];

[__NSCFArray objectForKeyedSubscript:]: unrecognized selector sent to instance 0x149857d40 terminating with uncaught exception of type NSException

有谁知道我应该如何编写此行以正确获取 field_pet_photo_path 中返回的数据 (url)? 查看以下返回数据:

"field_pet_photo_path" =         {
            und =             (
                                {
                    format = "<null>";
                    "safe_value" = "/files/stored/1460652721.jpg";
                    value = "/files/stored/1460652721.jpg";
                }
            );
        };    
NSDictionary *dic = [responseObject valueForkey : @"field_pet_photo_path];
NSArray *arr = [dic valueForkey : @"und"];
NSDictionary *dic2= [arr objectAtIndex : 0];
NSString *path = [dic2 valueForkey : @"safe_value"];

如果需要键名或带双引号的键字符串,则使用 @"\"safe_value\""

希望这会有所帮助:)

更新:

尝试用

替换NSString *path = [dic2 valueForkey : @"safe_value"];

NSString* path = [NSString stringWithFormat:@"%@", [dic2 valueForkey : @"safe_value"]];