title: Compile Errors in untouched AppDelegate.m
body: <p>I have been creating a simple example app to demonstrate playing sound files in IOS.</p>
  
  <p>For this I have created a very simple XCode project with one view controller. However, although my AppDelegate.h and .m files have remained unedited I am getting strange parse issues in the AppDelegate.m.</p>
  
  <p>On the line <strong>@Implimentation</strong> the compiler tells me its missing '@end'.</p>
  
  <p>On the line <strong>-(BOOL) application: (UIApplication <em>) application didFinishLaunchingWithOptions: (NSDictionary</em>) launch options</strong> it tells me Expected ';' after method prototype.</p>
  
  <p>The issues seem to stem from the #import "ViewController.h" reference in the AppDelegate.m file. As when I remove this these two errors go away, and get replaced with Receiver 'ViewController' for class message is a forward declaration, which is what I would expect with a missing import.</p>
  
  <p>This is an odd problem. I've built several IOS apps before but never encountered this issue. For background info the project was created as a Single View App in XCode 4. I have properly lined the IBOutlets and Properties of the ViewController.h to the XIB in interface builder. I have also added in the AudioToolbox framework in via the <strong>build phases > Link Library with Libraries</strong> feature.</p>
  
  <p>Here is the delegete and view controller files files</p>
  
  <p><strong>AppDelegate.m</strong></p>
  
  <pre><code>#import "AppDelegate.h"
  #import "ViewController.h"
  
  @implementation AppDelegate
  
  
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
      self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
      // Override point for customization after application launch.
      self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
      self.window.rootViewController = self.viewController;
      [self.window makeKeyAndVisible];
      return YES;
  }
  
  - (void)applicationWillResignActive:(UIApplication *)application
  {
      // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
      // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
  }
  
  - (void)applicationDidEnterBackground:(UIApplication *)application
  {
      // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
      // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  }
  
  - (void)applicationWillEnterForeground:(UIApplication *)application
  {
      // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
  }
  
  - (void)applicationDidBecomeActive:(UIApplication *)application
  {
      // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
  }
  
  - (void)applicationWillTerminate:(UIApplication *)application
  {
      // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  }
  
  @end
  </code></pre>
  
  <p><strong>AppDelegate.h</strong></p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @class ViewController;
  
  @interface AppDelegate : UIResponder &lt;UIApplicationDelegate&gt;
  
  @property (strong, nonatomic) UIWindow *window;
  
  @property (strong, nonatomic) ViewController *viewController;
  
  @end
  </code></pre>
  
  <p><strong>ViewContoller.m</strong></p>
  
  <pre><code>#import "ViewController.h"
  #import &lt;AudioToolbox/AudioToolbox.h&gt;
  
  @interface ViewController ()
  
  SystemSoundID pig;
  SystemSoundID cow;
  SystemSoundID sheep;
  SystemSoundID chicken;
  @end
  
  @implementation ViewController
  
  @Synthesize but_cow, but_pig, but_sheep, but_chicken;
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      // Do any additional setup after loading the view, typically from a nib.
  
      NSString * cowSoundURL= [[NSBundle mainBundle] pathForResource:@"cow" ofType: @"mp3"];
      NSString * pigSoundURL= [[NSBundle mainBundle] pathForResource:@"pig" ofType: @"mp3"];
      NSString * sheepSoundURL= [[NSBundle mainBundle] pathForResource:@"sheep" ofType: @"mp3"];
      NSString * chiickenSoundURL= [[NSBundle mainBundle] pathForResource:@"chicken" ofType: @"mp3"];
  
      AudioServicesCreateSystemSoundID(cowSoundURL, &amp;cow);
      AudioServicesCreateSystemSoundID(pigSoundURL, &amp;pig);
      AudioServicesCreateSystemSoundID( sheepSoundURL, &amp;sheep);
      AudioServicesCreateSystemSoundID(chickenSoundURL, &amp;chicken);
  }
  
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  //====================================================
  /**
   Called when a button is pressed
   **/
  //====================================================
  -(IBAction)buttonPressed:(id)sender
  {
      if (sender == but_cow)
      {
          AudioServicesPlaySystem(cow);
      }
      else if (sender == but_sheep)
      {
          AudioServicesPlaySystem(sheep);
      }
      else if (sender ==  but_pig)
      {
          AudioServicesPlaySystem(pig);
      }
      else if (sender == but_chicken)
      {
          AudioServicesPlaySystem(chicken);
      }
  
  }//===================================================
  @end
  </code></pre>
  
  <p><strong>ViewController.h</strong></p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface ViewController : UIViewController
  
  
  @property (nonatomic, retain) IBOutlet UIButton * but_cow;
  @property (nonatomic, retain) IBOutlet UIButton * but_pig;
  @property (nonatomic, retain) IBOutlet UIButton * but_sheep;
  @property (nonatomic, retain) IBOutlet UIButton * but_chicken;
  
  
  
  -(IBAction)buttonPressed:(id)sender;
  </code></pre>
  
  <p>Thanks very much for taking the time to read this.</p>