久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <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="qwawimqqmiuu" 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屋-程序員軟件開發(fā)技術(shù)分享
        <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="qwawimqqmiuu" 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 命名約定以返回“擁有"對象的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我目前正在使用 iOS 5 SDK 嘗試開發(fā)我的應(yīng)用程序.我正在嘗試使 NSString 成為屬性,然后在 .m 文件中合成它(我之前已經(jīng)這樣做了,沒有任何問題).現(xiàn)在,我遇到了這個問題:語義問題:屬性的合成 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!!

                  推薦答案

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

                  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"開頭的方法創(chuàng)建對象,您將獲得該對象的所有權(quán).

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

                  一個名為 newTitle 的屬性在合成時會產(chǎn)生一個名為 -newTitle 的方法,因此會出現(xiàn)警告/錯誤.-newTitle 應(yīng)該是 newTitle 屬性的 getter 方法,但是命名約定規(guī)定名稱以 new 開頭的方法返回一個對象它歸調(diào)用者所有,而 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 的方法不會返回調(diào)用者擁有的對象可能會讓其他閱讀您的代碼的人感到困惑.

                  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 已發(fā)布 Transitioning到 ARC 發(fā)行說明,他們在其中聲明:

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

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

                  他們已經(jīng)被告知他們的陳述不太準(zhǔn)確:罪魁禍?zhǔn)资?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)),包括一個修復(fù)它,用于屬性名稱與特殊方法系列前綴之一匹配的一般情況.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.

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

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

                  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(圖標(biāo)已經(jīng)包含光澤效果)
                  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="qwawimqqmiuu" 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>
                            主站蜘蛛池模板: 成人精品久久日伦片大全免费 | 日本欧美在线观看视频 | 久久精品色欧美aⅴ一区二区 | 国产伦精品一区二区三区精品视频 | 精品久久久久久久久亚洲 | 美国一级片在线观看 | 日本不卡免费新一二三区 | 欧美aⅴ | 国产精品综合色区在线观看 | 久久国产精品久久久久 | 久久这里只有精品首页 | v片网站 | 精品一二区 | 日本一区二区视频 | 国产视频一视频二 | 国产精品久久国产精品99 gif | 夜夜艹| 日日av | 成人在线观看免费视频 | www久久久 | 日本精品裸体写真集在线观看 | 97色在线视频| 亚洲视频一区在线观看 | 欧美另类视频在线 | 狠狠的操 | 久久伊人在| 精品国产久| 国产精品不卡一区二区三区 | 高清免费在线 | 中午字幕在线观看 | 中文字幕免费在线 | 精品区一区二区 | 日韩一区二区成人 | 狠狠的干狠狠的操 | 国际精品久久 | www.婷婷| 国产91 在线播放 | 国产精品久久午夜夜伦鲁鲁 | 亚洲欧洲小视频 | 欧美精品一区二区三区四区 | 少妇黄色|