Play Audio iOS Objective-C

后端 未结 7 1293
南旧
南旧 2020-11-30 00:25

I\'m trying to get an audio file playing in my iOS app. This is my current code

NSString *soundFilePath = [NSString stringWithFormat:@\"%@/test.m4a\", [[NSBu         


        
7条回答
  •  情书的邮戳
    2020-11-30 00:31

    You need to store a strong reference to 'AVAudioPlayer'

    @property (strong) AVAudioPlayer *audioPlayer;
    

    And if you are sure that your audio file is in following Bundle Resources, it should play.

    Project>Build Phases>Copy

提交回复
热议问题