I have thoroughly looked through this forum and I have not found a solution to this issue. When my app launches during the splash screen I want a 5 sec sound clip to play then stop when the app is done launching and the home screen is shown.
In the AppDelegate.m
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *musicFile = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"bknewsroom2"
ofType:@"caf"]];
AVAudioPlayer *launchClip = [[AVAudioPlayer alloc] initWithContentsOfURL:musicFile error:nil];
[launchClip play];
Now I have a whole bunch of stuff loading within didFinishLaunchingWithOptions this is just one of many things. The sound won’t launch in the simulator nor will it launch on my phone. So am I missing something? Again it is a 5 second clip that I want to play when the app launches for the first time. Any advice would be greatly appreciated.
I fixed this issue:
in the AppDelegate.m
Now when the application launches, the sound clip plays. It does hiccup once which I’m looking into, but the function works. Also, I put this at the top of
didFinishLaunchingWithOptionsif it was in the middle some place, it would work.