ios - Objective-C - Trying to play sound -


i trying play sound in app following code:

nsstring *soundfilepath = [[nsbundle mainbundle] pathforresource:@"errorbeep.wav" oftype:@"m4a"];         nsurl *soundfileurl = [nsurl fileurlwithpath:soundfilepath];          avaudioplayer *player = [[avaudioplayer alloc] initwithcontentsofurl:soundfileurl                                                                        error:nil];         player.numberofloops = -1; //infinite          [player play]; 

but sound not play :(

after debugging, can see soundfilepath nil here screenshot of resources file:

enter image description here

you should import file project 1 extension. thats what's going on. re-import file 1 extension (i.e, errorbeep.m4a)


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -