이것은 잠시 동안 고치려는 문제입니다. AudioToolbox 프레임 워크를 사용하여 iOS 용으로 만들려는 앱으로 헤더 파일에 오류가 발생합니다. 코드는 다음과 같습니다.Xcode 4.6의 AudioToolbox로 소리를 재생할 때 오류가 발생했습니다.
#import <iAd/iAd.h>
#import <UIKit/UIKit.h>
#import <AudioToolbox/AudioToolbox.h>
#import <iAd/ADBannerView_Deprecated.h>
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
@interface ViewController : UIViewController <ADBannerViewDelegate> {
ADBannerView *adView;
BOOL bannerIsVisible;
}
@property (nonatomic, assign) BOOL bannerIsVisible;
- (IBAction)cstring:(id)sender {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"CString", CFSTR ("caf"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
}
@end
또한 사운드 파일은 보조 파일 폴더에 있습니다.
오류 * 무엇 * * 오류가 –
인 경우 유용 할 수 있습니다. IBAction에서 중괄호를 오류를 유지하는 세미콜론으로 바꾸라고 알려줍니다. –