Ios 新版本的Xcode导致音频播放代码中断
首先我必须说,我是iOS开发的初学者。我将感谢任何帮助。 我已经编写了一个代码,当某些按钮被触动时播放声音,在以前的Xcode版本中工作得很好,但在这个新版本中,不会播放声音。在构建代码的过程中,没有错误报告,当我打开iPhone4S模拟器时,其他一切都正常工作,这就是代码的目标。请帮忙 这是我的密码: 文件.hIos 新版本的Xcode导致音频播放代码中断,ios,iphone,xcode,audio,Ios,Iphone,Xcode,Audio,首先我必须说,我是iOS开发的初学者。我将感谢任何帮助。 我已经编写了一个代码,当某些按钮被触动时播放声音,在以前的Xcode版本中工作得很好,但在这个新版本中,不会播放声音。在构建代码的过程中,没有错误报告,当我打开iPhone4S模拟器时,其他一切都正常工作,这就是代码的目标。请帮忙 这是我的密码: 文件.h 我在其他一些讨论中找到了解释。显然,模拟器工作不正常。 我找到了解决方案,只需下载Xcode 5.1.1即可完成我的项目 #import <UIKit/UIKit.h> #
我在其他一些讨论中找到了解释。显然,模拟器工作不正常。 我找到了解决方案,只需下载Xcode 5.1.1即可完成我的项目
#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
- (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 =@"Buckklick";
SystemSoundID soundID;
NSString *soundPath = [[NSBundle mainBundle] pathForResource:effectTitle ofType:@"wav"];
NSURL *soundUrl = [NSURL fileURLWithPath:soundPath];
AudioServicesCreateSystemSoundID ((__bridge CFURLRef)soundUrl, &soundID);
AudioServicesPlaySystemSound(soundID);
}