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: