Building Ipad app and once i added a modal view my bool errors out - xcode

I am erroring out with Bool and before I added a modal view and now it says bool is undefined. I dont understand why that is unless its because I'm using another nib for my modal view.
Do I need to call or change my boon now. Please advise.
//
// UrbanAgentViewController.m
// UrbanAgent
//
// Created by Dwayne Stephens on 4/2/12.
// Copyright 2012 __MyCompanyName__. All rights reserved.
//
#import "UrbanAgentViewController.h"
#import "NewContactController.h"
#implementation UrbanAgentViewController
// our own buttonTapped method
-(IBAction) buttonTapped: (id) sender {
NewContactController *ivc = [[NewContactController alloc] init];
ivc.delegate = self;
UINavigationController *nc = [[UINavigationController alloc]
initWithRootViewController:ivc];
[self presentModalViewController:nc animated:YES];
[ivc release];
[nc release];
}
-(void) doneButtonPressed: (NSArray *) values
{
[self dismissModalViewControllerAnimated:YES];
NSString *message =
[[NSString alloc]
initWithFormat:#"The values were %#, %#, %#, %#, %#, and %#",
[values objectAtIndex:0], [values objectAtIndex:1], [values objectAtIndex:2],
[values objectAtIndex:3], [values objectAtIndex:4], [values objectAtIndex:5]];
UIAlertView *alert =
[[UIAlertView alloc] initWithTitle:#"Values Passed"
message:message delegate:nil
cancelButtonTitle:#"Excellent!" otherButtonTitles:nil ];
[alert show];
[alert release];
[message release];
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
#end

You need a closing curly brace on doneButtonPressed:.

Related

xcode How to link UIAlertview action to another viewcontroller?

Im am trying to link one of my buttons from the UIAlertView that pops up so that It changes to another viewcontroller. Basically, the cancel already works, but when Next is clicked it doesnt, and i don't know how to link to another viewcontroller. Please help.
#import "ViewController.h"
#interface ViewController() <UIAlertViewDelegate>
#end
#implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)clickButton:(id)sender {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: #"Test" message: #"Message" delegate: self cancelButtonTitle:#"Cancel" otherButtonTitles:#"Redeem", nil];
[alert show];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if(buttonIndex == 1){ //Next
UIViewController* newView = [[UIViewController alloc] init];
[self presentViewController:newView animated:YES completion:nil];
}
}
#end
It is working...Just create object of viewcontroller that you want to present instead of
UIViewController* newView = [[UIViewController alloc] init];
like
SecondViewController * newView = [[SecondViewController alloc] initWithNibName:#"SecondViewController" bundle:nil];
if you are using xib.
Or
SecondViewController * newView = [self.storyboard instantiateViewControllerWithIdentifier:#"SecondViewController"];
if you are using storyboard(if you want to go through coding).
and then write
[self presentViewController:newView animated:YES completion:nil];
line.

UIImagePickerController crashes on launch

I present a viewcontroller to the user with a view that shows a UIButton to record a video. When the user presses the button, my app crashes with the following error:
Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'preferredInterfaceOrientationForPresentation must return a supported interface orientation!'
My app only supports portrait orientation and the info.plist file reflects properly. I use the same code in another app, found on Ray Wenderlich's site, and it works great. The code for the .h and .m files is below. Any help would be appreciated.
.h
#import <MediaPlayer/MediaPlayer.h>
#import <MobileCoreServices/UTCoreTypes.h>
#import <AssetsLibrary/AssetsLibrary.h>
#interface RecordSwingViewController: UIViewController
-(BOOL)startCameraControllerFromViewController:(UIViewController*)controller
usingDelegate:(id )delegate;
-(void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error contextInfo:(void*)contextInfo;
#property (weak, nonatomic) IBOutlet UIButton *record;
- (IBAction)recordSwing:(id)sender;
#end
.m
#import "RecordSwingViewController.h"
#interface RecordSwingViewController ()
#end
#implementation RecordSwingViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)recordSwing:(id)sender {
[self startCameraControllerFromViewController:self usingDelegate:self];
}
-(BOOL)shouldAutorotate
{
return NO;
}
-(BOOL)startCameraControllerFromViewController:(UIViewController*)controller
usingDelegate:(id )delegate {
// 1 - Validattions
if (([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] == NO)
|| (delegate == nil)
|| (controller == nil)) {
return NO;
}
// 2 - Get image picker
UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;
// Displays a control that allows the user to choose movie capture
cameraUI.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
// Hides the controls for moving & scaling pictures, or for
// trimming movies. To instead show the controls, use YES.
cameraUI.allowsEditing = NO;
cameraUI.delegate = delegate;
// 3 - Display image picker
[controller presentViewController: cameraUI animated: YES completion:nil];
return YES;
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];
[self dismissViewControllerAnimated:NO completion:nil];
// Handle a movie capture
if (CFStringCompare ((__bridge_retained CFStringRef) mediaType, kUTTypeMovie, 0) == kCFCompareEqualTo) {
NSString *moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(moviePath)) {
UISaveVideoAtPathToSavedPhotosAlbum(moviePath, self,
#selector(video:didFinishSavingWithError:contextInfo:), nil);
}
}
}
-(void)video:(NSString*)videoPath didFinishSavingWithError:(NSError*)error contextInfo:(void*)contextInfo {
if (error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Error" message:#"Video Saving Failed"
delegate:nil cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alert show];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Video Saved" message:#"Saved To Photo Album"
delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alert show];
}
}
#end
Ok, here is the answer, finally.
https://stackoverflow.com/a/12570501/2133494
Basically I needed to add a category to my UIImagePickerController. I tried a lot of other fixes but this worked.
You have implemented the bool for autorotation, but did not specify if it does not auto rotate what else it should do. Try the following after autorotate method.
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}
Please remove any of the masks you don't need from the method above and see if this works for you.

Warning: Attempt to present <MachinesDetailViewController: 0x1e5bfc50> on <UITabBarController: 0x1f867d90> whose view is not in the window hierarchy

Im trying to get a scanned QR code to display a view controller with information about the item the code represents. When I try and segue to the detail view controller, it comes up with:
Warning: Attempt to present <MachinesDetailViewController: 0x1e5bfc50> on <UITabBarController: 0x1f867d90> whose view is not in the window hierarchy!
The MainViewController is withing a main tab bar controller, but the detail view controller is within a navigation controller which is withing the tab bar controller.
Heres my MainViewController.m where this is sitting.
//
// FirstViewController.m
// Fitness Plus+
//
// Created by Tom Brereton on 26/01/13.
// Copyright (c) 2013 Tom Brereton. All rights reserved.
//
#import "MainViewController.h"
#import "MachinesDetailViewController.h"
#interface MainViewController ()
#end
#implementation MainViewController
#synthesize resultText, machineKeys, codeInt, machineArea, machineName;
- (IBAction)scanButton:(id)sender {
NSLog(#"ehe");
// ADD: present a barcode reader that scans from the camera feed
ZBarReaderViewController *reader = [[ZBarReaderViewController alloc] init];
reader.readerDelegate = self;
reader.supportedOrientationsMask = ZBarOrientationMaskAll;
ZBarImageScanner *scanner = reader.scanner;
// TODO: (optional) additional reader configuration here
// EXAMPLE: disable rarely used I2/5 to improve performance
[scanner setSymbology: ZBAR_I25
config: ZBAR_CFG_ENABLE
to: 0];
NSLog(#"Got here");
// present and release the controller
[self presentViewController: reader
animated: YES
completion:nil];
}
- (void) imagePickerController: (UIImagePickerController*) reader
didFinishPickingMediaWithInfo: (NSDictionary*) info
{
// ADD: get the decode results
id<NSFastEnumeration> results =
[info objectForKey: ZBarReaderControllerResults];
ZBarSymbol *symbol = nil;
for(symbol in results)
// EXAMPLE: just grab the first barcode
break;
NSLog(#"Naht Here");
// EXAMPLE: do something useful with the barcode data
// Scan the machines.plist array and print it to the console.
NSString *filePath = [[NSBundle mainBundle] pathForResource:#"machines" ofType:#"plist"];
NSDictionary *machineDict = [NSDictionary dictionaryWithContentsOfFile:filePath];
machineKeys = [machineDict objectForKey:#"Exercises"];
machineArea = [machineDict objectForKey:#"Area"];
resultText.text = symbol.data;
//Convert code into integer value and put it inside codeInt
codeInt = [symbol.data intValue];
NSLog(#"Scanned Value: %#", [machineKeys objectAtIndex:codeInt]);
// EXAMPLE: do something useful with the barcode image
[self performSegueWithIdentifier:#"showDetailFromMain" sender:reader];
// ADD: dismiss the controller (NB dismiss from the *reader*!)
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)reader {
if ([[segue identifier] isEqualToString:#"showDetailFromMain"]) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:#"MainStoryboard" bundle:nil];
MachinesDetailViewController *machineViewController = [storyboard instantiateViewControllerWithIdentifier:#"showMachineDetailViewController"];
machineViewController = [segue destinationViewController];
machineName = [machineKeys objectAtIndex:codeInt];
[machineViewController setMachineNameLabel: machineName];
}
}
- (void) viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#end
The ZBar stuff is just relating to the QR scanning API.
And here is the MachineDetailsViewController.m.
//
// MachinesDetailViewController.m
// Fitness Plus+
//
// Created by Tom Brereton on 27/01/13.
// Copyright (c) 2013 Tom Brereton. All rights reserved.
//
#import "MachinesDetailViewController.h"
#interface MachinesDetailViewController ()
#property(nonatomic, copy) NSString *title;
#end
#implementation MachinesDetailViewController
#synthesize machineLabel, machineName, instructionsLabel, typeLabel, mainMuscleLabel, otherMuscleLabel, equipmentLabel, machineDictionary, machineArray, mainMuscleLabelString, instructionLabelString, typeLabelString, otherMuscleLabelString, equipmentLabelString, title, machineNameLabel;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
// Set the Label text with the selected machine name
machineName = machineNameLabel;
mainMuscleLabel.text = mainMuscleLabelString;
otherMuscleLabel.text = otherMuscleLabelString;
equipmentLabel.text = equipmentLabelString;
typeLabel.text = typeLabelString;
instructionsLabel.text = instructionLabelString;
self.navigationItem.title = machineName;
NSLog(#"got it");
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#end
Thanks, if you need more info just ask.
Tom
Struggled with the exact same issue,
my solution was to call the segue this way:
[reader dismissViewControllerAnimated:YES completion:^{
NSLog(#"Perform segue");
[self performSegueWithIdentifier:#"showDetailFromMain" sender:self];
}];
I also had to connect the segue to the view and not to a single button.
Hope this works for you.

How do I stop a sound when a new sound button is pressed

I'm new to Xcode and I'm having an issue, if you click the sound buttons multiple times they overlap each other. How would I set my code so that if you click a button while a sound is playing it will stop the current sound playing and start the new one.
If you could post the code it would be much appreciated.
Thanks,
Dominick
Here is a copy of my current code:
#import "Sound3ViewController.h"
#implementation Sound3ViewController
-(IBAction)playnow:(id)sender;{
soundFile = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:#"winning"
ofType:#"mp3"]];
sound = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFile error:nil];
sound.delegate = self;
[sound play];
}
- (IBAction)play2:(id)sender {
soundFile = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:#"onadrug"
ofType:#"mp3"]];
sound = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFile error:nil];
sound.delegate = self;
[sound play];
}
- (void)dealloc
{
[super dealloc];
[sound release];
[super dealloc];
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad];
}
*/
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#end
I would suggest you to disallow playing the sound with a variable and schedule an action that allows it again after the duration of the file. Eg:
boolean allowed = true
-(IBAction)playnow:(id)sender
{
if (allowed) { // <--- ADD THIS
allowed = false;
soundFile = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:#"winning"
ofType:#"mp3"]];
sound = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFile error:nil];
sound.delegate = self;
[sound play];
NSInvocation *invocation = [[NSInvocation alloc] init];
[invocation setTarget:self];
[invocation setSelector:#selector(allowPlaying)];
[NSTimer scheduledTimerWithTimeInterval:[sound duration] invocation:invocation repeats:NO];
} // <-- AND THIS
}
-(void)allowPlaying
{
allow = true;
}
Didn't test it since just wrote on the fly but you've got the general idea..
I'm new to objC also, so I'm not sure this is correct, but try this:
#import "Sound3ViewController.h"
#implementation Sound3ViewController
-(IBAction)playnow:(id)sender;{
soundFile = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:#"winning"
ofType:#"mp3"]];
// NEW STUFF
if (sound) {
if ([sound playing]) {
[sound stop];
}
[sound release];
}
sound = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFile error:nil];
sound.delegate = self;
[sound play];
}
- (IBAction)play2:(id)sender {
soundFile = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:#"onadrug"
ofType:#"mp3"]];
if (sound) {
if ([sound playing]) {
[sound stop];
}
[sound release];
}
sound = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFile error:nil];
sound.delegate = self;
[sound play];
}
- (void)dealloc
{
[super dealloc];
if (sound) {
[sound release];
}
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad];
}
*/
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#end
// in .h file
#import "AVFoundation/AVAudioPlayer.h"
//set delegate
#interface SamplesoundViewController : UIViewController <AVAudioPlayerDelegate>{
AVAudioPlayer *player1;
AVAudioPlayer *player2;
...
...
}
#property (nonatomic, retain) AVAudioPlayer *player1;
#property (nonatomic, retain) AVAudioPlayer *player2;
-(IBAction)soundfirst;
-(IBAction)soundsecond;
-(IBAction)Newmethodname;
// in .m file
#implementation SamplesoundViewController
#synthesize player1,player2;
-(IBAction)soundfirst{
NSString *path = [[NSBundle mainBundle] pathForResource:#"soundfilefirst" ofType:#"mp3"];
player1=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
player1.delegate=self;
[player1 play];
[self performSelector:#selector(soundsecond) withObject:nil afterDelay:0.90];
}
-(IBAction)soundsecond{
[player1 stop];
NSString *path = [[NSBundle mainBundle] pathForResource:#"Soundfilesecond" ofType:#"mp3"];
player2=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
player2.delegate=self;
[player2 play];
[self performSelector:#selector(Newmethodname) withObject:nil afterDelay:1];
}
-(IBAction)Newmethodname{
[player2 stop];
//write your code here
}

Need help debugging switchChanged method

Am getting error ("switchChanged" undeclared) in the implementation file, but can't find the problem. Can you help me?
TIA
ViewController.m
#import "Control_FunViewController.h"
#implementation Control_FunViewController
#synthesize nameField;
#synthesize numberField;
#synthesize sliderLabel;
#synthesize leftSwitch;
#synthesize rightSwitch;
#synthesize doSomethingButton;
-(IBAction)sliderChanged:(id)sender
{
UISlider *slider = (UISlider *)sender;
int progressAsInt = (int)(slider.value + 0.5f);
NSString *newText = [[NSString alloc] initWithFormat:#"%d",progressAsInt];
sliderLabel.text = newText;
[newText release];
}
-(IBAction)textFieldDoneEditing:(id)sender
{
[sender resignFirstResponder];
}
-(IBAction)backgroundTap:(id)sender
{
[nameField resignFirstResponder];
[numberField resignFirstResponder];
}
-(IBAction)toggleControls:(id)sender
{
if ([sender selectedSegmentIndex] == kSwitchesSegmentIndex)
{
leftSwitch.hidden = NO;
rightSwitch.hidden = NO;
doSomethingButton.hidden = YES;
}
else {
leftSwitch.hidden =YES;
rightSwitch.hidden =YES;
doSomethingButton.hidden = NO;
}
-(IBAction)switchChanged:(id)sender
{
UISwitch *whichSwitch = (UISwitch *)sender;
BOOL setting = whichSwitch.isOn;
[leftSwitch setOn:setting animated:YES];
[rightSwitch setOn:setting animated:YES];
}
-(IBAction)buttonPressed
{
//TODO: Implement Action Sheet and Alert
}
}
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[nameField release];
[numberField release];
[sliderLabel release];
[leftSwitch release];
[rightSwitch release];
[doSomethingButton release];
[super dealloc];
}
#end
ViewController.h
#import <UIKit/UIKit.h>
#define kSwitchesSegmentIndex 0
#interface Control_FunViewController : UIViewController {
UITextField *nameField;
UITextField *numberField;
UILabel *sliderLabel;
UISwitch *leftSwitch;
UISwitch *rightSwitch;
UIButton *doSomethingButton;
}
#property(nonatomic,retain)IBOutlet UITextField *nameField;
#property(nonatomic,retain)IBOutlet UITextField *numberField;
#property(nonatomic,retain)IBOutlet UILabel *sliderLabel;
#property(nonatomic,retain)IBOutlet UISwitch *leftSwitch;
#property(nonatomic,retain)IBOutlet UISwitch *rightSwitch;
#property(nonatomic,retain)IBOutlet UIButton *doSomethingButton;
-(IBAction)textFieldDoneEditing:(id)sender;
-(IBAction)backgroundTap:(id)sender;
-(IBAction)sliderChanged:(id)sender;
-(IBAction)toggleControls:(id)sender;
-(IBAction)switchChanged:(id)sender;
-(IBAction)buttonPressed;
#end
The colon (:) is part of the name of the method, but you haven't included it in the error message. It may be that you just forgot, but if you're calling -switchChanged (no colon) from somewhere, or if you connected a control using the action -switchChanged (no colon), that's the problem. Perhaps you added the colon and sender parameter later on?

Resources