Home > Mobile >  IOS how to put the audio files written to the local in the app
IOS how to put the audio files written to the local in the app

Time:09-16

IOS how the app in the audio files written to the local (similar to video in photo album), can you put the audio file is written to cheat??????? Great god help! Genuflect is begged!!!!!

CodePudding user response:

NSURL * path=[[NSBundle mainBundle] URLForResource: @ "sound. Mp3" withExtension: nil];

//the file is written to memory
NSData * data=https://bbs.csdn.net/topics/[NSData dataWithContentsOfURL: path];
Nsstrings * filePath=[NSHomeDirectory () stringByAppendingPathComponent: @ "sound. Mp3"].
[data writeToFile: filePath atomically: YES];

//read from the local files and play
The self. The player=[[AVAudioPlayer alloc] initWithContentsOfURL: [NSURL URLWithString: filePath] error: nil];
[self. Player play];

CodePudding user response:

CodePudding user response:

I may not be clear, do not broadcast, is generated in the project of audio in the mobile phone, can see directly on the phone,

CodePudding user response:

reference dongyangTan reply: 3/f
I may not be clear, do not broadcast, is generated in the project write to mobile phones, audio on a mobile phone can see directly,

I also meet this requirement, can you tell me you solved

CodePudding user response:

Is directly to photo album can browse video directly through the photo album
  •  Tags:  
  • iOS
  • Related