在新的Xcode 6.3中,我得到了这样的警告:
动态自动属性合成不会合成属性‘
’;它将由它的超类实现,使用@dynamic确认意图
我怎样才能删除它?
发布于 2015-04-09 19:34:45
我只是删除了这个属性声明,因为它已经在父类中声明了
发布于 2015-04-09 19:35:05
如果您有意覆盖超类中的相同属性,则在*.m或*.mm文件中添加@dynamic,如下所示:
@implementation MyClass
@dynamic homeInt;
// ...
@end如果不是,请重命名该属性。
发布于 2015-05-08 07:35:37
在@mplace的注释之后,在我的示例中,我重写了该属性,以将该属性的类型优化为该属性的原始类的子类。所以,我确实需要@property重写。
下面是我使用的代码:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-property-synthesis"
// superclass type for currentValue was "id"
@property (nonatomic, strong) NSDate *currentValue;
#pragma clang diagnostic pop请注意,它是"-Wobjc-property-synthesis“,而不是"-Wno-objc-property-synthesis”
另请参阅https://github.com/couchbase/couchbase-lite-ios/issues/660
https://stackoverflow.com/questions/29534654
复制相似问题