Sound's working on simulator but not on device
Helle everyone !
I have a problem ...
I would like te play a short sound on my iPhone. On the simulator it's working perfectly but when I put my app on my iphone nothing happends ... Why ?
Here's my code :
SoundEffect .h
SoundEffect.m
MyView.h
MyView.m
So it's working 100% on simulator.
I don't understand why it's not working on my device.
I have correctly imported my sound in my project...
Please I need some help
Thanks !
I have a problem ...
I would like te play a short sound on my iPhone. On the simulator it's working perfectly but when I put my app on my iphone nothing happends ... Why ?
Here's my code :
SoundEffect .h
Code:
#import <UIKit/UIKit.h>
#import <AudioToolbox/AudioServices.h>
@interface SoundEffect : NSObject {
SystemSoundID soundID;
}
-(void)play;
- (id)initWithContentsOfFile:(NSString *)path;
@end
SoundEffect.m
Code:
#import "SoundEffect.h"
@implementation SoundEffect
- (id)initWithContentsOfFile:(NSString *)path
{
self = [super init];
if (self != nil) {
NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
}
return self;
}
-(void)play {
AudioServicesPlaySystemSound(soundID);
}
@end
MyView.h
Code:
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
@class SoundEffect;
@interface ViewOne : UIView {
SoundEffect *soundEffect;
SoundEffect *soundEffect2;
}
MyView.m
Code:
- (void)awakeFromNib {
NSBundle *mainBundle = [NSBundle mainBundle];
soundEffect = [[SoundEffect alloc]initWithContentsOfFile:[mainBundle pathForResource:@"sound1" ofType:@"mp3"]];
soundEffect2 = [[SoundEffect alloc]initWithContentsOfFile:[mainBundle pathForResource:@"sound2" ofType:@"mp3"]];
}
// A button action
- (IBAction)MakeSound {
if(//condition)
[soundEffect play];
else
[soundEffect2 play];
}
So it's working 100% on simulator.
I don't understand why it's not working on my device.
I have correctly imported my sound in my project...
Please I need some help

Thanks !
Device supports .caf, aif & wav. but simulator also supports mp3 !