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 ...
随机推荐
- .net-一般处理程序及生命周期
IsReusable属性用来表示在IHttpHandlerFactory对象创建IHttpHandler的时候是否能够将这个Handler存入池中以便重用. 一般处理程序(HttpHandler):是 ...
- sp_makewebtask
Transact-SQL 参考 sp_makewebtask 创建一项生成 HTML 文档的任务,该文档包含执行过的查询返回的数据. 说明 所有 Web 作业在企业管理器的"作业分类& ...
- C#隐藏桌面图标和任务栏
最近因为项目需要需要实现桌面图标和任务状态栏的隐藏功能,实现的方式很多,比如修改注册表值,调用windows API函数等.经过一番的查阅,这个功能暂时实现了,或许不是很好的方法,但是我预期的效果达到 ...
- BZOJ 1083: [SCOI2005]繁忙的都市(MST)
裸的最小生成树..直接跑就行了 ---------------------------------------------------------------------- #include<c ...
- 采用translate实现垂直水平居中
今天分享一个利用css3新特性实现垂直水平居中的方法. 通过对元素进行绝对定位再配合transform中的translate实现. 代码如下: html <div id="conten ...
- 微信上传素材返回 '{"errcode":41005,"errmsg":"media data missing"}',php5.6返回
问题描述: php5.5已经把通过@加文件路径上传文件的方式给放入到Deprecated中了.php5.6默认是不支持这种方式了 解决办法curl处理 function curl_post($url, ...
- 神奇的魔法数字0x61c88647
来源JDK源码,产生的数字分布很均匀 用法代码如下. # -*- coding: utf-8 -*- HASH_INCREMENT = 0x61c88647 def magic_hash(n): fo ...
- 3_Guess Fingers
3 // // ViewController.swift // Guess Fingers // // Created by ZC on 16/1/8. // Copyright © 2016年 ZC ...
- 关于js的一些关键知识点(call,apply,callee, caller,clourse,prototypeChain)
可能不少学习javascript在使用call,apply,callee时会感到困惑,以下希望对于你有所帮助: 1.~~~call ,apply是函数(函数对象)的方法:callee是函数argume ...
- 超强1000 JQuery插件
转载:超强1000个jquery插件! http://www.cnblogs.com/chu888chu888/archive/2011/12/18/2292014.html