ios - Convert NSData from local NSURL -
I have a sound player that uses the AVAudioPlayer class. I download some items in another view and store it as a php path as NSURL, then pass NSURL to the player view controller. But I get an error when I try to pass the object
*** Expected exceptions' NSInvalidArgumentException ', due to reason the application ended:' - [__ NSCFString Path]: non The recognized selector is sent to Example 0x1700c86c0 and here is the code: NSData * Data = [NSData dataWithContentsOfFile: [podcastSource path]]; NSError * error; MPlayer = [[Aviado Player Alok] initWithData: Data Error: & amp; Error]; [Empler set Deliaget: Self]; If (Emplier == zero) {NSLog (@ "% @", error); } And {{self. Play Player]; Note that the FilePath I receive from NSURL is in this form: / var / mobile / application / xxxxxx / The document looks like error code such as podcastSource
- / Code> is an NSString when it is going to request your way to it> need to be a
NSUrl However, dataWithContentsOfFile:. If an NSString accepts logic, then there is no need to convert podcastSource a NSUrl or for request that The path of NSUrl If podcastSource is in its entirety, it should work: NSData * data = [NSData dataWithContentsOfFile: podcastSource];
Comments
Post a Comment