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 ...
随机推荐
- ASP.NET之电子商务系统开发-1(数据列表)
一.前言 首先声明的是,这是我第一个与别人合作的.net项目,另一个人做的是后台管理,我做的前台,这是一个电子商务的系统,主要实现的功能是查看商品以及购物功能. 二.开始 首先看一下我截取的项目部分商 ...
- spring+hibernate基础
把数据库的配置信息写在一个文件中 jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.url=jdbc\:mysql\://localhost\:3306/ ...
- Matlab中的取整-floor,ceil,fix,round
FLOOR Round towards minus infinity. FLOOR(X) rounds the elements of X to the nearest integers toward ...
- Visual format language
所谓的VFL语言其实就是Visual format language 的缩写,是一种使用代码添加约束的方式,类似于Masonry SDAutolayout的效果,但是操作起来可能要相对简单.一行代码 ...
- WPF之DataGrid应用(转)
原文:http://blog.csdn.net/sanjiawan/article/details/6785394 前几天打算尝试下DataGrid的用法,起初以为应该很简单,可后来被各种使用方法和功 ...
- 转移服务器,DEDE网站遇到no input file specified!
公司新配置了服务器,需要从旧服务器上把原来的站点迁移到新服务器,迁移.NET网站没有遇到任何问题,但是在迁移过来一个用DEDE做的网站后,访问首页出现No Input File Specified,后 ...
- [转]Swift 编程语言入门教程
今天在网上看到一篇非常好的教程,分享给大家 原文地址:http://gashero.iteye.com/blog/2075324 目录 1 简介 2 Swift入门 3 简单值 4 控 ...
- 全新的ASP.NET !
全新的ASP.NET ! 背景 最新版本的 ASP.NET 叫做 ASP.NET Core (也被称为 ASP.NET 5) 它颠覆了过去的 ASP.NET. 什么是 ASP.NET Core? ...
- 没有开发者账号,如何解锁wp8设备
原文 http://www.cnblogs.com/vsdot/p/3263454.html 问题的引入 好了,问题的由来是这样的,我想把我开发的wp8手机部署到手机上,可是竟然出现了下面的问题: [ ...
- 细说SSO单点登录(转)
什么是SSO? 如果你已知道,请略过本节! SSO核心意义就一句话:一处登录,处处登录:一处注销,处处注销.即:在多个应用系统中,用户只需要登录一次就可以访问所有相互信任的应用系统. 很多人容易把SS ...