アプリを起動しましたが、アプリを起動したらすぐに再生するオーディオ クリップが必要です。これは私のview controller.mファイルです:
//
// ViewController.m
// audio test
//
// Created by Kevin Patrick on 14/07/2012.
// Copyright (c) 2012 Team Tops. All rights reserved.
//
#import "ViewController.h"
#import <AVFoundation/AVFoundation.h>
@interface ViewController ()
@end
@implementation ViewController
-(void)awakeFromNib {
NSString *path = [[NSBundle mainBundle]
pathForResource:@"CPOP MUSIC"ofType:@"mp3"];
AVAudioPlayer* theAudio = [[AVAudioPlayer alloc]
initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
[theAudio play];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
@end
しかし、アプリがサウンドを再生しないとシミュレートすると、空白で何もしません。サポート ファイル フォルダにオーディオ ファイルがあります。最新の Xcode に問題があることを確認しましたが、ファイルはまだ再生されません。