1
처음에는 iOS 개발의 초보자입니다. 나는 어떤 도움을 주셔서 감사합니다. 특정 버튼을 터치 할 때 사운드를 재생하는 코드를 만들었습니다. 이전 Xcode 버전에서는 정상적으로 작동했지만이 새 버전에서는 사운드가 재생되지 않습니다. 코드를 작성하는 동안 오류가보고되지 않으며 iPhone 4 용 시뮬레이터를 켜면 다른 모든 것이 올바르게 작동합니다.이 코드는 해당 코드의 대상입니다. 도와주세요. file.h (오디오 재생이 필요 한 부분)오디오 재생 코드가 Xcode의 새 버전으로 깨졌습니다.
#import <UIKit/UIKit.h>
#import <AudioToolbox/AudioToolbox.h>
#import <CoreLocation/CoreLocation.h>
@interface DataViewController : UIViewController <CLLocationManagerDelegate> {
int nob, nof, nod;
CLLocationManager *locationManager;
}
@property (strong, nonatomic) IBOutlet UILabel *maxDistanceLabel;
@property (nonatomic,strong) NSArray *fetchedSettingsArray;
@property (nonatomic,retain) NSNumber *numB;
- (IBAction)forwardB:(id)sender;
- (IBAction)backB:(id)sender;
@property (strong, nonatomic) IBOutlet UILabel *numberB;
@end
file.m
- (IBAction)forwardB:(id)sender {
nob ++;
NSString *nobStr=[NSString stringWithFormat:@"%d",nob];
[numberB setText:nobStr];
numB=[NSNumber numberWithInt:nob];
//sound at button touch
NSString *effectTitle;
effectTitle [email protected]"Buckklick";
SystemSoundID soundID;
NSString *soundPath = [[NSBundle mainBundle] pathForResource:effectTitle ofType:@"wav"];
NSURL *soundUrl = [NSURL fileURLWithPath:soundPath];
AudioServicesCreateSystemSoundID ((__bridge CFURLRef)soundUrl, &soundID);
AudioServicesPlaySystemSound(soundID);
}