error: property's synthesized getter follows Cocoa naming convention for returning 'owned' objects
出现这样的情况,主要是属性名中包括 keyword.
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:
@property (strong, nonatomic, getter=theNewTitle) NSString *newTitle;
Keeping both the property name and the getter name, and telling the compiler that, even though the getter name starts with
new
,
it belongs to thenone
method
family as opposed to thenew
method
family:#ifndef __has_attribute
#define __has_attribute(x) 0 // Compatibility with non-clang compilers
#endif #if __has_attribute(objc_method_family)
#define BV_OBJC_METHOD_FAMILY_NONE __attribute__((objc_method_family(none)))
#else
#define BV_OBJC_METHOD_FAMILY_NONE
#endif @interface ViewController : UIViewController
@property (strong, nonatomic) NSString *newTitle;
- (NSString *)newTitle BV_OBJC_METHOD_FAMILY_NONE;
@end
Note that even though this solution allows you to keep
newTitle
as
both the property name and the getter name, having a method called-newTitle
that
doesn’t return an object owned by the caller can be confusing for other people reading your code.
error: property's synthesized getter follows Cocoa naming convention for returning 'owned' objects的更多相关文章
- 小胖说事24-----property's synthesized getter follows Cocoa naming convention for returning 'owned' objec
今天在给类的属性命名的时候,用了newValue.就给报错:property's synthesized getter follows Cocoa naming convention for retu ...
- Error解决:Property's synthesized getter follows Cocoa naming convention for returning 'owned'
在项目中定义了以new开头的textField.结果报错: 先看我的源代码: #import <UIKit/UIKit.h> @interface ResetPasswordViewCon ...
- Property's synthesized getter follows Cocoa naming convention for returning
Property's synthesized getter follows Cocoa naming convention for returning. 今天早上在整理代码的时候发现了如上警告. ...
- JSON: Property 'xxx' has no getter method的解决办法
在使用JSONArray.fromObject时候出现JSONException:Property 'xxx' has no getter method. 解决办法:设置bean为public属性即可 ...
- JSON: property "xxx" has no getter method in class "..."
Exception in thread "main" net.sf.json.JSONException: java.lang.NoSuchMethodException: Pro ...
- 【python】面向对象编程之@property、@setter、@getter、@deleter用法
@property装饰器作用:把一个方法变成属性调用 使用@property可以实现将类方法转换为只读属性,同时可以自定义setter.getter.deleter方法 @property&@ ...
- ios 常见问题解决
一,libxml/HTMLparser.h file not find 第一种方法: 点击左边项目的根目录,再点击右边的Build Settings,手工输入文字:“Header search pat ...
- ARC
ARC是什么 ARC是iOS 5推出的新功能,全称叫 ARC(Automatic Reference Counting).简单地说,就是代码中自动加入了retain/release,原先需要手动添加的 ...
- IOS- 02 零碎知识总结
1.UIView,UIViewController,UIWindow和CALayer UIView是什么,做什么:UIView是用来显示内容的,可以处理用户事件 CALayer是什么,做什么:CALa ...
随机推荐
- sql update 触发器 可获得被update的行的信息
类型:转载 sql update 触发器 可获得被update的行的信息,需要的朋友可以参考下. 复制代码 代码如下: create trigger TgName on tb for update ...
- 覆盖与重载与隐藏——SAP电面(3)
参考:http://man.chinaunix.net/develop/c&c++/c/c.htm#_Toc520634042 8.2.1 重载与覆盖 成员函数被重载的特征: (1)相同的范围 ...
- hdu 4619 Warm up 2 二分图匹配
题目链接 给两种长方形, 水平的和垂直的, 大小都为1*2, n个水平的, m个垂直的, 给出它们的坐标. 水平的和垂直的可以相互覆盖, 但是同种类型的没有覆盖. 去掉一些长方形, 使得剩下的全部都没 ...
- Python keyword 模块 -- 学习笔记
keyword 的帮助文档 >>> import keyword >>> help(keyword) Help on module keyword: NAME ke ...
- Linux下使用ps命令来查看Oracle相关的进程
Linux下可以使用ps命令来查看Oracle相关的进程 Oracle Listener 这个命令会列出Oracle Net Listener的进程 [oracle@ www.linuxidc.com ...
- Android系统设置— android.provider.Settings
android.provider.Settings Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS); sta ...
- C语言 HTTP上传文件-利用libcurl库上传文件
原文 http://justwinit.cn/post/7626/ 通常情况下,一般很少使用C语言来直接上传文件,但是遇到使用C语言编程实现文件上传时,该怎么做呢? 借助开源的libcurl库,我们 ...
- HDU 1147 Pick-up sticks
题解:每放一根棍子,都判断一下它与它前面的且在顶端的棍子是否相交,相交的话则将相应的棍子从解空间中除去. #include <cstdio> const double eps=1e-14; ...
- BZOJ 1000 A+B Problem (I/O)
#include<cstdio> int main(){ int a,b; scanf("%d%d",&a,&b); printf("%d&q ...
- 配置管理多个ssh key
假设需要为两台主机建立ssh key以便抓取.更新代码,主机A:111.111.111.111,主机B:222.222.222.222. 首先,用两个账户(hostA@email.com与hostB@ ...