4 Replies Latest reply: Jan 30, 2013 1:46 PM by disguise
SparxElectronics Level 1 Level 1 (0 points)

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 <UIKit/UIKit.h>

#import <AVFoundation/AVAudioPlayer.h>

 

 

 

@interface ViewController : UIViewController <AVAudioPlayerDelegate> {

   

   

}

-(IBAction)playSound1;

-(IBAction)playSound2;

-(IBAction)playSound3;

-(IBAction)playSound4;

 

 

 

@end