pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  • <i id='gA0PW'><tr id='gA0PW'><dt id='gA0PW'><q id='gA0PW'><span id='gA0PW'><b id='gA0PW'><form id='gA0PW'><ins id='gA0PW'></ins><ul id='gA0PW'></ul><sub id='gA0PW'></sub></form><legend id='gA0PW'></legend><bdo id='gA0PW'><pre id='gA0PW'><center id='gA0PW'></center></pre></bdo></b><th id='gA0PW'></th></span></q></dt></tr></i><div class="dx7jxbt" id='gA0PW'><tfoot id='gA0PW'></tfoot><dl id='gA0PW'><fieldset id='gA0PW'></fieldset></dl></div>

    1. <small id='gA0PW'></small><noframes id='gA0PW'>

    2. <legend id='gA0PW'><style id='gA0PW'><dir id='gA0PW'><q id='gA0PW'></q></dir></style></legend>

        <bdo id='gA0PW'></bdo><ul id='gA0PW'></ul>

        <tfoot id='gA0PW'></tfoot>

      1. 語義問題:屬性的合成 getter 遵循 Cocoa 命名約定以

        Semantic Issue: Property#39;s synthesized getter follows Cocoa naming convention for returning #39;owned#39; objects(語義問題:屬性的合成 getter 遵循 Cocoa 命名約定以返回“擁有對象) - IT屋-程序員軟件開發技術分享
        <legend id='cPYgk'><style id='cPYgk'><dir id='cPYgk'><q id='cPYgk'></q></dir></style></legend>

        <small id='cPYgk'></small><noframes id='cPYgk'>

        • <i id='cPYgk'><tr id='cPYgk'><dt id='cPYgk'><q id='cPYgk'><span id='cPYgk'><b id='cPYgk'><form id='cPYgk'><ins id='cPYgk'></ins><ul id='cPYgk'></ul><sub id='cPYgk'></sub></form><legend id='cPYgk'></legend><bdo id='cPYgk'><pre id='cPYgk'><center id='cPYgk'></center></pre></bdo></b><th id='cPYgk'></th></span></q></dt></tr></i><div class="z5pfnzt" id='cPYgk'><tfoot id='cPYgk'></tfoot><dl id='cPYgk'><fieldset id='cPYgk'></fieldset></dl></div>

              <tbody id='cPYgk'></tbody>
            <tfoot id='cPYgk'></tfoot>
            • <bdo id='cPYgk'></bdo><ul id='cPYgk'></ul>
                  本文介紹了語義問題:屬性的合成 getter 遵循 Cocoa 命名約定以返回“擁有"對象的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我目前正在使用 iOS 5 SDK 嘗試開發我的應用程序.我正在嘗試使 NSString 成為屬性,然后在 .m 文件中合成它(我之前已經這樣做了,沒有任何問題).現在,我遇到了這個問題:語義問題:屬性的合成 getter 遵循 Cocoa 命名約定以返回‘擁有’對象."

                  I'm currently using the iOS 5 SDK trying to develop my app. I'm trying to make an NSString a property, and then to synthesize it in the .m file (I have done this before with no issues). Now, I came across this: "Semantic Issue: Property's synthesized getter follows Cocoa naming convention for returning 'owned' objects."

                  這是我的代碼:.h

                  @interface ViewController : UIViewController {
                       NSString *newTitle;
                  }
                  @property (strong, nonatomic) NSString *newTitle;
                  

                  .m

                  @synthesize newTitle;
                  

                  有人知道我該如何解決這個問題嗎?謝謝!!

                  Does anyone have a clue how I could fix this? Thanks!!

                  推薦答案

                  我猜你使用的編譯器版本如下 內存管理規則 用于聲明的屬性——更具體地說,用于聲明的屬性的訪問器:

                  My guess is that the compiler version you’re using follows the memory management rules for declared properties, too — more specifically, for declared properties’ accessors:

                  如果您使用名稱以alloc"、new"、copy"或mutableCopy"開頭的方法創建對象,您將獲得該對象的所有權.

                  You take ownership of an object if you create it using a method whose name begins with "alloc", "new", "copy", or "mutableCopy".

                  一個名為 newTitle 的屬性在合成時會產生一個名為 -newTitle 的方法,因此會出現警告/錯誤.-newTitle 應該是 newTitle 屬性的 getter 方法,但是命名約定規定名稱以 new 開頭的方法返回一個對象它歸調用者所有,而 getter 方法則不然.

                  A property named newTitle, when synthesised, yields a method called -newTitle, hence the warning/error. -newTitle is supposed to be a getter method for the newTitle property, however naming conventions state that a method whose name begins with new returns an object that’s owned by the caller, which is not the case of getter methods.

                  您可以通過以下方式解決此問題:

                  You can solve this by:

                  1. 重命名該屬性:

                  1. Renaming that property:

                  @property (strong, nonatomic) NSString *theNewTitle;
                  

                1. 保留屬性名稱并指定不以特殊方法名稱前綴之一開頭的 getter 名稱:

                2. 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;
                  

                3. 同時保留屬性名和getter名,并告訴編譯器,即使getter名以new開頭,它也屬于nonenew 方法族相對的方法族:

                4. 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 the none method family as opposed to the new 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
                  

                  請注意,即使此解決方案允許您將 newTitle 保留為屬性名稱和 getter 名稱,但有一個名為 -newTitle 的方法不會返回調用者擁有的對象可能會讓其他閱讀您的代碼的人感到困惑.

                  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.

                  <小時>

                  作為記錄,Apple 已發布 Transitioning到 ARC 發行說明,他們在其中聲明:

                  您不能為屬性指定以 newcopy 開頭的名稱.

                  You cannot give a property a name that begins with new or copy.

                  他們已經被告知他們的陳述不太準確:罪魁禍首是 getter 方法名稱,而不是屬性名稱.

                  They’ve already been notified that their statement is not quite accurate: the culprit is the getter method name, not the property name.

                  2015 年 1 月 17 日我剛剛注意到一個 最近對 Clang 的提交建議上面的選項 3(使用 objc_method_family(none)),包括一個修復它,用于屬性名稱與特殊方法系列前綴之一匹配的一般情況.Xcode 最終可能會包含此更改.

                  Edit 17 Jan 2015: I’ve just noticed a recent commit to Clang that suggests option 3 above (using objc_method_family(none)), including a fix-it, for the general case where a property name matches one of the special method family prefixes. Xcode will likely incorporate this change eventually.

                  這篇關于語義問題:屬性的合成 getter 遵循 Cocoa 命名約定以返回“擁有"對象的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!
                5. 相關文檔推薦

                  How to animate a UIImageview to display fullscreen by tapping on it?(如何通過點擊動畫 UIImageview 以顯示全屏?)
                  To stop segue and show alert(停止 segue 并顯示警報)
                  iOS 5 storyboard, programmatically determine path(iOS 5 故事板,以編程方式確定路徑)
                  Icon already includes gloss effects(圖標已經包含光澤效果)
                  How does UIEdgeInsetsMake work?(UIEdgeInsetsMake 是如何工作的?)
                  UIProgressView and Custom Track and Progress Images (iOS 5 properties)(UIProgressView 和自定義跟蹤和進度圖像(iOS 5 屬性))

                6. <i id='mCRWv'><tr id='mCRWv'><dt id='mCRWv'><q id='mCRWv'><span id='mCRWv'><b id='mCRWv'><form id='mCRWv'><ins id='mCRWv'></ins><ul id='mCRWv'></ul><sub id='mCRWv'></sub></form><legend id='mCRWv'></legend><bdo id='mCRWv'><pre id='mCRWv'><center id='mCRWv'></center></pre></bdo></b><th id='mCRWv'></th></span></q></dt></tr></i><div class="x5nt7dh" id='mCRWv'><tfoot id='mCRWv'></tfoot><dl id='mCRWv'><fieldset id='mCRWv'></fieldset></dl></div>

                      <tfoot id='mCRWv'></tfoot>
                    • <small id='mCRWv'></small><noframes id='mCRWv'>

                        <tbody id='mCRWv'></tbody>
                        <bdo id='mCRWv'></bdo><ul id='mCRWv'></ul>
                        <legend id='mCRWv'><style id='mCRWv'><dir id='mCRWv'><q id='mCRWv'></q></dir></style></legend>
                            主站蜘蛛池模板: 驾驶式洗地机/扫地机_全自动洗地机_工业洗地机_荣事达工厂官网 | 昆山新莱洁净应用材料股份有限公司-卫生级蝶阀,无菌取样阀,不锈钢隔膜阀,换向阀,离心泵 | 亮化工程,亮化设计,城市亮化工程,亮化资质合作,长沙亮化照明,杰奥思【官网】 | 地源热泵一体机,地源热泵厂家-淄博汇能环保设备有限公司 | 定制防伪标签_防伪标签印刷_防伪标签厂家-510品保防伪网 | Brotu | 关注AI,Web3.0,VR/AR,GPT,元宇宙区块链数字产业 | RV减速机-蜗轮蜗杆减速机-洗车机减速机-减速机厂家-艾思捷 | 纯化水设备-EDI-制药-实验室-二级反渗透-高纯水|超纯水设备 | 口臭的治疗方法,口臭怎么办,怎么除口臭,口臭的原因-口臭治疗网 | 污水处理设备,一体化泵站,一体化净水设备-「梦之洁环保设备厂家」 | 合肥防火门窗/隔断_合肥防火卷帘门厂家_安徽耐火窗_良万消防设备有限公司 | 品牌广告服务平台,好排名,好流量,好生意。 | ★店家乐|服装销售管理软件|服装店收银系统|内衣店鞋店进销存软件|连锁店管理软件|收银软件手机版|会员管理系统-手机版,云版,App | 螺旋压榨机-刮泥机-潜水搅拌机-电动泥斗-潜水推流器-南京格林兰环保设备有限公司 | 家德利门业,家居安全门,别墅大门 - 安徽家德利门业有限公司 | 深圳美安可自动化设备有限公司,喷码机,定制喷码机,二维码喷码机,深圳喷码机,纸箱喷码机,东莞喷码机 UV喷码机,日期喷码机,鸡蛋喷码机,管芯喷码机,管内壁喷码机,喷码机厂家 | 昆明化妆培训-纹绣美甲-美容美牙培训-昆明博澜培训学校 | 马尔表面粗糙度仪-MAHR-T500Hommel-Mitutoyo粗糙度仪-笃挚仪器 | TTCMS自助建站_网站建设_自助建站_免费网站_免费建站_天天向上旗下品牌 | 电子万能试验机_液压拉力试验机_冲击疲劳试验机_材料试验机厂家-济南众标仪器设备有限公司 | 电液推杆生产厂家|电动推杆|液压推杆-扬州唯升机械有限公司 | 搪瓷反应釜厂家,淄博搪瓷反应釜-淄博卓耀 | 航空铝型材,7系铝型材挤压,硬质阳*氧化-余润铝制品 | NBA直播_NBA直播免费观看直播在线_NBA直播免费高清无插件在线观看-24直播网 | 中医治疗皮肤病_潍坊银康医院「山东」重症皮肤病救治平台 | 赛尔特智能移动阳光房-阳光房厂家-赛尔特建筑科技(广东)有限公司 | 安徽控制器-合肥船用空调控制器-合肥家电控制器-合肥迅驰电子厂 安徽净化板_合肥岩棉板厂家_玻镁板厂家_安徽科艺美洁净科技有限公司 | 合肥升降机-合肥升降货梯-安徽升降平台「厂家直销」-安徽鼎升自动化科技有限公司 | 四川成都干燥设备_回转筒干燥机_脉冲除尘器_输送设备_热风炉_成都川工星科机电设备有限公司 | 硬度计_影像测量仪_维氏硬度计_佛山市精测计量仪器设备有限公司厂家 | 水性漆|墙面漆|木器家具漆|水漆涂料_晨阳水漆官网 | 贵阳用友软件,贵州财务软件,贵阳ERP软件_贵州优智信息技术有限公司 | 冷却塔减速机器_冷却塔皮带箱维修厂家_凉水塔风机电机更换-广东康明冷却塔厂家 | 赛默飞Thermo veritiproPCR仪|ProFlex3 x 32PCR系统|Countess3细胞计数仪|371|3111二氧化碳培养箱|Mirco17R|Mirco21R离心机|仟诺生物 | 岩棉切条机厂家_玻璃棉裁条机_水泥基保温板设备-廊坊鹏恒机械 | BOE画框屏-触摸一体机-触控查询一体机-触摸屏一体机价格-厂家直销-触发电子 | 成都热收缩包装机_袖口式膜包机_高速塑封机价格_全自动封切机器_大型套膜机厂家 | 北京开业庆典策划-年会活动策划公司-舞龙舞狮团大鼓表演-北京盛乾龙狮鼓乐礼仪庆典策划公司 | 深圳湾1号房价_深圳湾1号二手房源| 石英陶瓷,石英坩埚,二氧化硅陶瓷-淄博百特高新材料有限公司 | 网优资讯-为循环资源、大宗商品、工业服务提供资讯与行情分析的数据服务平台 |