63183

AppDelegate.h errors - XCode

Question:

This is really weird. When coming back from school today and firing up my Mac Mini, I open up Xcode and I am presented with two errors in my AppDelegate.h file. One of these errors says Expected selector for Objective-C method and the other one is Expected method body. I googled these two errors and found nothing that could solve my case. I have tried restarting Xcode and as well as my computer. I have also tried "Cleaning" the project and still my problem is not resolved. What could this error be? Is it on my end? Or is this an Xcode bug? Thanks:

Code: AppDelegate.h

#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) UINavigationController *navigationController; @end

Answer1:

Check Your main.m File for any extra or invisible Code:

// // main.m // Demo // // Created by Stackoverflow on 12/20/12. // // #import <UIKit/UIKit.h> #import "AppDelegate.h" int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } }

Answer2:

What's in the corresponding .m file?

Are you @synthesizing accessors for your two properties? Failing to provide accessors (either synthesizing them or providing your own) seems like the most likely cause of the errors you've shown.

Have you implemented the usual app delegate methods? Off the top of my head, I'm not sure which if any app delegate methods are actually <em>required</em>, but your app isn't going to work very well and will produce some warnings if you don't have at least a -applicationDidFinishLaunching:withOptions:.

Answer3:

With Xcode newer than 5.0, Anyone confronting this issue can from the top menu\Product\Build. It should resume right in the spot.

Recommend

  • Swift class that inherits an Objective-C Base Class not casting to correct type
  • Solution for cleaning an image cache directory on the SD card
  • Java library to escape/clean XML?
  • Google analytics not sending any hits in iOS?
  • How to style GCKUIMiniMediaControlsViewController in iOS?
  • Forms with Prism: Application windows are expected to have a root VC
  • iPhone - UIWebView multiple locks
  • How to get to older Xcode beta version?
  • Safari PHP form submission -file upload hangs
  • Git cleanup/garbage collection on remote VSO git repository
  • Does Apportable support to build library binary (.a/.so)?
  • ASP.NET MVC Application won't update some controllers
  • Jenkins: FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection
  • Switching to Release Build causes runtime error in Web Reference
  • RectangularRangeIndicator format like triangular using dojo
  • Join two tables and save into third-sql
  • How to model a transition system with SPIN
  • ORA-29908: missing primary invocation for ancillary operator
  • Why winpcap requires both .lib and .dll to run?
  • QuartzCore.framework for Mono Develop
  • Return words with double consecutive letters
  • Is there a mandatory requirement to switch app.yaml?
  • Python: how to group similar lists together in a list of lists?
  • Acquiring multiple attributes from .xml file in c#
  • Hits per day in Google Big Query
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Linking SubReports Without LinkChild/LinkMaster
  • How can I remove ASP.NET Designer.cs files?
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Converting MP3 duration time
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal