0
我在我的project.the场景停留在AVAudioPlayer时, 在CollectionViewController的“didSelectItemAtIndexPath”的方法,我alloc和初始化AVAudioPlayer像波纹管,AVAudioPlayer为零后,我的Alloc初始化
dict=[plist objectAtIndex:indexPath.item];
NSURL* urlPath=[NSURL new];
urlPath=[NSURL URLWithString:[dict objectForKey:@"FilePath"]];
NSError *error = nil;
self.player=[[AVAudioPlayer alloc]initWithContentsOfURL:urlPath error:&error];
NSLog(@"Error[%@]",[error localizedDescription]);
[self.player setDelegate:self];
[self.player prepareToPlay];
但毕竟这,它仍然nill .. 第一,我想未做的player.but没有运气财产.... 所以我尽量用this
你仔细检查urlPath是不是零? –
@WorldOfWarcraft“urlPath”不是零.. – Vats
你把你的代码放在'didSelectItemAtIndexPath'中,这意味着只有当你选择了播放器的init。 –