简体   繁体   中英

error: @synthesize

In my AppDelegate.h file i written the following code

@interface iBountyHunterAppDelegate : NSObject <UIApplicationDelegate> {
    UITabBarController *tabcontroller;

}
@property (nonatomic,retain) IBOutlet UITabBarController *tabcontroller;

and in AppDelegate.h file I synthesize it.

@synthesize tabcontroller;

but in @synthesize line i get an error and the msg is: "MISSING CONTEXT FOR PROPERTY IMPLEMENTATION DECLARATION"

can anyone tell me how to solve it?

I suspect you have put the @synthesize outside of your @implementation. It should look something like this

//  iBountyHunterAppDelegate.m

#import "iBountyHunterAppDelegate.h"

@implementation iBountyHunterAppDelegate

@synthesize tabcontroller; // note that this is between @implementation and @end

// other stuff

@end

"and in AppDelegate.h file I synthesize it." Probably it´s just misspelled but it has to be in .m file :P

@interface iBountyHunterAppDelegate : NSObject <UIApplicationDelegate> 

{

    UITabBarController IBOutlet *tabcontroller;

}

@property (nonatomic,retain) IBOutlet UITabBarController *tabcontroller;

and in AppDelegate.h file I synthesize it.

@synthesize tabcontroller;

在controller(iBountyHunterAppDelegate.m)文件而不是接口(.h)文件中合成您的属性

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM