I am working on audio player in iOS 8 in Swift language.
I have an audio file name with "apple.mp3" in both male and female voices same audio name. Both files are two different groups, for male male group and for female audio female group. So paths would be male/apple.mp3 and female/apple.mp3.
I am using following code to play an audio file
var audioPlayer = AVAudioPlayer()
var currentAudioPath:NSURL!
currentAudioPath = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource(audioName, ofType: "mp3")!)
AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, error: nil)
AVAudioSession.sharedInstance().setActive(true, error: nil)
UIApplication.sharedApplication().beginReceivingRemoteControlEvents()
audioPlayer = AVAudioPlayer(contentsOfURL: currentAudioPath, error: nil)
audioPlayer.delegate = self
audioPlayer.play()
audioPlayer.prepareToPlay()
How can I play both audios separately with specific path?
1. Click each group, then click the square icon (see screenshot below) and choose the folder your project file is in. "None" will show up when you choose the same folder your .
Importing into XcodeOpen Xcode and select Open Another Project or File, Open. Open the folder you unzipped from your Dropsource download and locate the file with “. xcodeproj” extension in the root directory. Select the file and click Open.
In xcode on left pane in the project navigator at the bottom there is a search field. In the documentation it is called filter bar. According to Inder Kumar Rathore the shortcut is ⌘ + ⇧ + O .
Select the project you want to rename in the “Project Navigator” which can be found on the left side of the Xcode view. On the right-hand side of the window, select the “File Inspector”. The name of your project should be in there under “Identity and Type”, change it to “NEW” and press Enter.
To the best of my knowledge, if you have similar file names anywhere in the project, no matter how deep in a subfolder, Xcode will complain about duplicate resources. When you ask for an image by name, Xcode 'sees' the whole project, that's the up side.
In short, no, you cannot have two resources with identical name in the same project. It is advised to give a unique name to each one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With