1

Xcode でアプリを実行しようとすると、「Expected Method Body」エラーが発生し続けます。太字の場所は、エラーが発生した場所です。ヘルプ!!!もう1つ、「@implementation SoundnoardFirstViewController」部分で「不完全な実装」というエラーが発生し続けます。ヘルプ!!ありがとう

#import "SoundnoardFirstViewController.h"

@interface SoundnoardFirstViewController ()

@end

@implementation SoundnoardFirstViewController

-(IBAction)PlaySound1:(id)sender1

**-(IBAction)PlaySound2:(id)sender2**

-(IBAction)PlaySound3:(id)sender3

-(IBAction)PlaySound4:(id)sender4

-(IBAction)PlaySound5:(id)sender5

-(IBAction)PlaySound6:(id)sender6

(IBAction)PlaySound1:(id)sender1:(id)sender { 
    CFBundleRef mainBundle = CFBundleGetMainBundle();
    CFURLRef soundFileURLRef;
    soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"This is the name of the clip", CFSTR ("sound file type"), NULL);
    UInt32 soundID;
    AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
    AudioServicesPlaySystemSound(soundID);
 }

-(IBAction)PlaySound2:(id)sender2:(id)sender{ 
    CFBundleRef mainBundle = CFBundleGetMainBundle();
    CFURLRef soundFileURLRef;
    soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"DoYouHave?", CFSTR ("mp3"), NULL);
    UInt32 soundID;
    AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
    AudioServicesPlaySystemSound(soundID);
}

-(IBAction)PlaySound3:(id)sender3:(id)sender {
    CFBundleRef mainBundle = CFBundleGetMainBundle();
    CFURLRef soundFileURLRef;
    soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"Hello", CFSTR ("mp3"), NULL);
    UInt32 soundID;
    AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
    AudioServicesPlaySystemSound(soundID);
}

-(IBAction)PlaySound4:(id)sender4:(id)sender {
    CFBundleRef mainBundle = CFBundleGetMainBundle();
    CFURLRef soundFileURLRef;
    soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"SoupBetter?", CFSTR ("mp3"), NULL);
    UInt32 soundID;
    AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
    AudioServicesPlaySystemSound(soundID);
}
4

2 に答える 2

2

内部でプライベートメソッドを宣言しますSoundnoardFirstViewController ()

@interface SoundnoardFirstViewController ()

  //declare the private methods here

@end

例:

#import "SoundnoardFirstViewController.h"

@interface SoundnoardFirstViewController ()

-(IBAction)PlaySound1:(id)sender1:(id)sender;
-(IBAction)PlaySound2:(id)sender2:(id)sender

@end

@implementation SoundnoardFirstViewController

-(IBAction)PlaySound1:(id)sender1:(id)sender { 
    CFBundleRef mainBundle = CFBundleGetMainBundle();
    CFURLRef soundFileURLRef;
    soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"This is the name of the clip", CFSTR ("sound file type"), NULL);
    UInt32 soundID;
    AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
    AudioServicesPlaySystemSound(soundID);
 }

-(IBAction)PlaySound2:(id)sender2:(id)sender{ 
    CFBundleRef mainBundle = CFBundleGetMainBundle();
    CFURLRef soundFileURLRef;
    soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"DoYouHave?", CFSTR ("mp3"), NULL);
    UInt32 soundID;
    AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
    AudioServicesPlaySystemSound(soundID);
}
@end
于 2012-11-21T05:00:55.080 に答える