我有一个声音文件,我想在加载应用程序时播放,但我只能在你按下按钮时播放。我需要有一个 .h 文件还是仅适用于 .m 文件
#import "ViewController.h"
//sound
@implementation ViewController
-(void) viewDidLoad {
-(IBAction)play { Here i get error Expected expression.
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"app3", CFSTR
("m4a"), NULL);
UInt32 (soundID);
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
}
[super viewDidLoad];
}
-(IBAction)Facebook {
[[UIApplication sharedApplication]
openURL: [NSURL URLWithString:@"http://www.facebook.com/synicapps?fref=ts]"]];
}
@end