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

                  問題描述

                  限時送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="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>
                            主站蜘蛛池模板: av日韩精品 | 国产乱轮视频 | 69福利视频 | 国产精品视频一区二区三区 | 婷婷久久五月 | 日本少妇网站 | 成人在线精品 | 亚洲免费观看视频 | 我要看一级黄色片 | 日韩毛片网站 | 日本一级一片免费视频 | 日韩亚洲一区二区 | 亚洲黄色网址 | www.日韩 | 欧美日韩一区二区在线 | 国产美女自拍视频 | 黄色伊人| 欧美精品xxx | 四虎影院最新地址 | 久热99 | 亚洲激情片 | 天天色小说 | 日韩有码在线视频 | 欧美日韩成人在线 | 国产精品成人免费精品自在线观看 | 97成人免费视频 | 久久久久久久影院 | 免费性网站 | 久久国产精品一区二区 | 人人爽人人澡 | 黄色av免费 | 精品一区二区三区视频 | 人与拘一级a毛片 | 久久爱综合 | 午夜免费av | 亚洲专区一区 | 国产一区二区三区四区 | 久久精品一区二区三区四区 | 日韩激情视频 | 福利视频午夜 | 国产精品视频免费看 |