Pages

Wednesday, January 30, 2013

What Is The Cause Of My Xcode Errors, What Is The Cause Of My Xcode Errors

I get 2 errors 1 is it at

@interface "ViewController" I get the error "Expected Identifer or (" and "Expected Identifier"

 

And At:

@implementation ViewController I get Error "Incomplete Implementation"


----------------------------------

Here is a copy of source code

---------------------------------


.m File

-----------

 

//

//  ViewController.m

//  SoundLoud

//

//  Created by on 29/01/13.

//  Copyright (c) 2013 SparxElectronics. All rights reserved.

//

 

#import "ViewController.h"

 

 

@interface "ViewController"

@end

 

@implementation ViewController

-(IBAction)playSound1 {

   

    NSSTRING *path = [[NSBundle mainBundle] pathForResource:(@"Bell" *) ofType:@"mp3"];

    AVAudioPlayer *TheAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL

    TheAudio.delegate=self;

    [TheAudio play];

}

 

-(IBAction)playSound2 {

                                  

NSSTRING *path = [[NSBundle mainBundle] pathForResource:(@"Boing" *) ofType:@"mp3"];

AVAudioPlayer *TheAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL

TheAudio.delegate=self;

[TheAudio play];

                          

                          

                          

-(IBAction)playSound3 {

                              

NSSTRING *path = [[NSBundle mainBundle] pathForResource:(@"Phone Dial" *) ofType:@"mp3"];

AVAudioPlayer *TheAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL

TheAudio.delegate=self;

[TheAudio play];

                          

 

                          

-(IBAction)playSound1 {

                              

NSSTRING *path = [[NSBundle mainBundle] pathForResource:(@"Servo" *) ofType:@"mp3"];

AVAudioPlayer *TheAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL

TheAudio.delegate=self;

[TheAudio play];

 

 

------------

.h File

------------

//

//  ViewController.h

//  SoundLoud

//

//  Created by on 29/01/13.

//  Copyright (c) 2013 SparxElectronics. All rights reserved.

//

 

#import

#import

 

 

 

@interface ViewController : UIViewController <AVAudioPlayerDelegate> {

   

   

}

-(IBAction)playSound1;

-(IBAction)playSound2;

-(IBAction)playSound3;

-(IBAction)playSound4;

 

 

 

@end


View the original article here

0 comments:

Post a Comment