iphone - iOS 中的 “Property implementation must have its declaration in interface” 错误

标签 iphone objective-c ios properties getter-setter

<分区>

Possible Duplicate:
Objective C: “Property implementation must have its declaration in interface”

我在另一个 viewController 中全局声明了一个 viewController 的对象。

我很确定

1-我已经导入了必要的viewController类

2 - 我已经在 .h 文件中为该对象添加了 @property(nonatomic, keep)

3 - 我合成了相同的对象 .m 文件

但我仍然收到错误消息,指出“属性实现必须在接口(interface)中声明”。我在这里做错了什么......我一直在这个问题上摸不着头脑......

.h文件

#import "viewController1.h"

@interface viewController2 :UIViewController<UITableViewDelegate,UITableViewDataSource>{        
    viewController2 *vc2;
}

@property(nonatomic,retain)viewController2 *vc2;

-(void)someMethod;

@end

.m 文件

#import "viewController2.h"

@implementation viewController2

@synthesize vc2;

@end

最佳答案

  1. 清理你的项目
  2. 像这样声明属性:@property(readwrite,retain)viewController2 *vc2;

关于iphone - iOS 中的 “Property implementation must have its declaration in interface” 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8711931/

上一篇:iphone - 删除旧的 Coredata 类并添加新的类会导致 iOS 崩溃

下一篇:iphone - NSUserDefaults 值未保存 iPhone

相关文章:

ios - 仅使用 UIImageView 调整大小、居中和图像

javascript - 如何从 iOS 中保存为应用程序的页面打开新页面?

ios - 以编程方式检测iPad是否支持SIM卡

iphone - 错误 "_OBJC_CLASS_$_ISTAlertView",从 :"引用

objective-c - 监听驱动器安装事件/通知

ios - 导航栏中的背景图像转到屏幕顶部

javascript - 本地存储不适用于 iPad 浏览器私有(private)窗口

ios - 如何将数据库文件作为项目的一部分包含在 iOS 中,它位于我的 Mac 上的路径 Library/..Applications/../dbfile.sqlite

iphone - 在 iPad 上截取部分屏幕截图

javascript - 在 iOS 上隐藏 URL 栏而不隐藏 Smart App Banner