0

我收到此错误消息:- [MPConcreteMediaItem isEqualToString:]: unrecognized selector sent to instance...</p>

我正在从媒体选择器创建一个 NSMutable 歌曲数组到一个名为“array”的数组中。该数组正确显示在 tableview (myTable) 中。但是,当我尝试转到详细视图并将歌曲标题发送到本教程之后的详细视图上的标签时。我收到上面的崩溃和错误消息。

感谢任何帮助,谢谢!

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    if ([[segue identifier] isEqualToString:@"detailView"]) {

    NSIndexPath *indexPath = [self.myTable indexPathForSelectedRow];

    DetailViewController *vc = [segue destinationViewController];

    vc.trackName = [array objectAtIndex:indexPath.row];

    //crashes -[MPConcreteMediaItem isEqualToString:]: unrecognized selector sent to instance

    }

}

- (void)mediaPicker:(MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection {

    [array addObjectsFromArray:mediaItemCollection.items];

    [myTable reloadData];

    // mediaItemCollection = nil;

    [mediaPicker dismissViewControllerAnimated:YES completion:nil];

}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    //this method is called to fill out table with data

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];

    if (cell == nil) {

    cell = [[UITableViewCell alloc]

    initWithStyle:UITableViewCellStyleDefault

    reuseIdentifier:@"Cell"];

}

    // Configure the cell

    anItem = nil;

    anItem = [array objectAtIndex:indexPath.row];

    cell.textLabel.text = [anItem valueForProperty:MPMediaItemPropertyTitle];

    cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;

    return cell;

}
4

1 回答 1

0

该错误看起来像您没有在字符串对象上调用“isEqualToString:”...哪个超类具有 MPConcreteMediaItem

于 2013-01-16T21:22:51.273 回答