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

#import <AVFoundation/AVAudioPlayer.h>




@interface ViewController : UIViewController <AVAudioPlayerDelegate> {

}

-(IBAction)playSound1;

-(IBAction)playSound2;

-(IBAction)playSound3;

-(IBAction)playSound4;




@end

Posted on Jan 29, 2013 12:16 AM

Reply
4 replies

Jan 29, 2013 7:43 PM in response to SparxElectronics

Also I don;t see the closing brace on any of your playsound functions.




-(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];



Is it really that way in your code or did it get lost in the cut and paste.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

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

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.