Xcode has issues about Autosynthesized property 'ViewController' and similary about 'window' and tells me the properties are declared in BSAppDelegate.h. I don’t know how to fix this even though several people here have tried to explain the underscore issue. When I omit any of the lines below which mention ViewController or window, my app will not compile.
//
// BSAppDelegate.h
//
#import <UIKit/UIKit.h>
@class BSViewController;
@interface BSAppDelegate : UIResponder <UIApplicationDelegate>{
UIWindow *window;
BSViewController *viewController;
}
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) BSViewController *viewController;
@end
When you declare properties, you don’t need to also declare the same variables in the instance variables section. In other words, this should be fine:
If your app fails to compile like this, do you have a second @interface section and/or do you have @synthesize statements in the implementation file? As of Xcode 4.4 you don’t need the @synthesize statements anymore, but if you don’t explicitly synthesize the properties then Xcode will synthesize them with a preceding underscore (_window or _viewController). Here’s a link with more information: Automatic Property Synthesis With Xcode 4.4.