I have some buttons linked to an IBAction
that plays a sound.
-(IBAction)listen {
// play the audio
}
My files are organized with On Demand Resources, and I have 3 tags:
So what I'd like to achieve is:
if the user is on level 1, he will only be able to play files with the level1
tag. If he clicks on a level2
tag audio, an alert will appear.
How can I check if a file has a specific tag?
I'm not aware of an API to access a resource's ODR tags, so you have to use some other way to map resources to access controls in your app code. Perhaps you can use pathForResource(_:ofType:)
to inspect the path of the resource, and if it is in the directory "level2", prevent your user from accessing the resource until they are on the appropriate level?