ios - AVAudioPlayer crashes on play -
working on audio first time. may missing please guide
i have added avfoundation framework. added #import
and added in viewdidload.
nsstring* docpath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) lastobject]; nsstring* audiopath = [docpath stringbyappendingpathcomponent:@"001.mp3"]; bool fileexists = [[nsfilemanager defaultmanager] fileexistsatpath:audiopath]; if (!fileexists) { nslog(@"audio file not exist!"); }else{ nserror *error; nsurl *url = [[nsurl alloc] initfileurlwithpath:audiopath]; nsdata *audiodata = [nsdata datawithcontentsofurl:url]; self.audioplayer = [avaudioplayer alloc]; // crashes @ line self.audioplayer = [self.audioplayer initwithdata:audiodata error:&error]; nslog(@"%@",self.audioplayer); }
i using generic breakpoint exception. player making crash because of break point no details. removed breakpoint , worked fine. thank guys.
Comments
Post a Comment