小胖说事24-----property's synthesized getter follows Cocoa naming convention for returning 'owned' objec

今天在给类的属性命名的时候,用了newValue,就给报错:property‘s synthesized
getter follows Cocoa naming convention for returning ‘owned‘ objects
,一阵郁闷不知道咋回事,后来查了资料后,原来是命名规范的事情:

You own any object you create

You create an object using a method whose name begins with “alloc”, “new”, “copy”, or “mutableCopy” (for example, allocnewObject,
or mutableCopy).

一定要注意命名规范,不能以alloc,new,copy,mutableCopy 作为开头命名,比如:newValue。留此做个笔记,纪念一下。

版权声明:本文为博主原创文章,未经博主允许不得转载。

小胖说事24-----property's synthesized getter follows Cocoa naming convention for returning 'owned' objec

时间: 2024-11-07 15:16:24

小胖说事24-----property's synthesized getter follows Cocoa naming convention for returning 'owned' objec的相关文章

error: property's synthesized getter follows Cocoa naming convention for returning 'owned' objects

出现这种情况,主要是属性名中包含  关键字. You can solve this by: Renaming that property: @property (strong, nonatomic) NSString *theNewTitle; Keeping the property name and specifying a getter name that doesn't begin with one of the special method name prefixes: @proper

Error解决:Property's synthesized getter follows Cocoa naming convention for returning 'owned'

在项目中定义了以new开头的textField,结果报错: 先看我的源码: #import <UIKit/UIKit.h> @interface ResetPasswordViewController : UIViewController @property (weak, nonatomic) IBOutlet UITextField *phoneTextField; @property (weak, nonatomic) IBOutlet UITextField *oldPasswordTe

编译错误Property&#39;s synthesized getter follows Cocoa naming convention for returning &#39;owned&#39; objectss

错误在于你的工程下的某一个类中的下面这行 @property (retain, nonatomic) NSString *newImage; 错误就是因为用了new这个关键字,所以说我把new改为news就好了 严格上来说,主要的错误原因是 声明属性时要遵循内存管理原则,即不要使用某些关键字 编译错误Property's synthesized getter follows Cocoa naming convention for returning 'owned' objectss

错误: Property&#39;s synthesized getter follows Cocoa naming convention for returning &#39;owned&#39;

今天遇到一个奇怪的问题,一开始用下面的代码定义一个全局变量: @property (strong, nonatomic) NSDictionary          *newHomeDataDictionary; 结果一直报错误: Property's synthesized getter follows Cocoa naming convention for returning 'owned',看了好久也找不出问题,后来该前面 new 单词,发现就可以了,这才发现是苹果禁止了所有已 new 关

error: property&#39;s synthesized getter follows Cocoa naming convention for returning &#39;owned&#39; objects I

error: property's synthesized getter follows Cocoa naming convention for returning 'owned' objects In file included from /Users/developer/Documents/StarShow/ShowWall/View/NewShowItemView.m:9: /Users/developer/Documents/StarShow/ShowWall/View/NewShowI

小胖说事35-----Terminating app due to uncaught exception &amp;#39;CALayerInvalidGeometry&amp;#39;, reason: &amp;#39;CALayer posi

2011-06-11 15:19:17.167 ***[930:707] *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [160 nan]' *** Call stack at first throw: ( 0   CoreFoundation                      0x3365d64f __exce

小胖说事35-----Terminating app due to uncaught exception &#39;CALayerInvalidGeometry&#39;, reason: &#39;CALayer posi

2011-06-11 15:19:17.167 ***[930:707] *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [160 nan]' *** Call stack at first throw: ( 0   CoreFoundation                      0x3365d64f __exce

黑马程序员——OC语言@property、@synthesized与id

一.@property @synthesize关键字 注意:这两个关键字是编译器特性,让xcode可以自动生成getter和setter的声明和实现. (一)@property 关键字 @property 关键字可以自动生成某个成员变量的setter和getter方法的声明 @property int age; 编译时遇到这一行,则自动扩展成下面两句: - (void)setAge:(int)age; - (int)age; (二)@synthesize关键字 @synthesize关键字帮助生

小胖说事29-----iOS中Navigation中左滑pop页面的三种方法

1.系统自带pop方法">系统自带pop方法 如果我们没有对navigation中的back按钮进行自定义,我们可以直接使用系统自带的左滑pop方法.但是如果我们对back按钮,进行了自定义,我们就要对self.navigationController.interactivePopGestureRecognizer这个属性进行设置了.关键代码: __weak typeof(self) weakSelf = self; self.navigationController.interactiv