NSInternalInconsistency Exception - findPlaylistByID is Invalid - What does that mean?
I am catching an error in XCode 4 without making any changes. A screen shot of the error is attached and here is the code that I am suspecting is causing the issue. Please help me out if you can, I am not sure why I am getting this error:
e- (void)fetchVideoInfoForPlaylist:(id)aDict {
BrightcoveDemoAppDelegate *delegate = (BrightcoveDemoAppDelegate *)[[UIApplication sharedApplication] delegate];
BCMediaAPI *bc = delegate.bcServices;
PlaylistCacheObject *playlistCacheObj;
BCPlaylist *playlist = (BCPlaylist *)[aDict objectForKey:PLAYLIST_DICT_KEY];
UITableViewCell *cell = (UITableViewCell *)[aDict objectForKey:CELL_DICT_KEY];
NSNumber *key = [NSNumber numberWithLong:playlist.playlistId];
if ([playlistCache objectForKey:key]) {
playlistCacheObj = [playlistCache objectForKey:key];
}
else {
// request, stash in cache
NSError *err;
playlist = [bc findPlaylistById:playlist.playlistId videoFields:[NSArray arrayWithObjects:@"thumbnailURL",nil] playlistFields:[NSArray arrayWithObjects:@"videos", @"thumbnailURL",nil] customFields:nil error:&err];
if (!playlist) {
[[ErrorHandlerService sharedInstance] logMediaAPIError:err];
}
else if (playlist.videos && [playlist.videos count] > 0) {
[playlist.videos objectAtIndex:0];
// fetch the thumbnai for the first video
NSString *imageURL = [playlist thumbnailURL];
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imageURL]]];
playlistCacheObj = [[[PlaylistCacheObject alloc] initWithData:playlist image:image] autorelease];
[playlistCach开发者_如何学Ce setObject:playlistCacheObj forKey:key]; ; }
}
The assertion is being thrown from BCPlaylistReadService
, not PlaylistTableViewController
. I suspect there's an NSAssert
in there. I would guess from this that either playlist
or playlist.playlistId
is nil
, but alternately playlist.playlistId
might just be invalid as the assertion notes.
精彩评论