{"id":1296,"date":"2017-01-16T20:15:35","date_gmt":"2017-01-16T11:15:35","guid":{"rendered":"http:\/\/www.chihayafuru.jp\/tech\/?p=1296"},"modified":"2018-05-12T13:02:09","modified_gmt":"2018-05-12T04:02:09","slug":"%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%83%95%e3%82%a1%e3%83%9f%e3%83%aa%e3%83%bc","status":"publish","type":"post","link":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/archives\/1296","title":{"rendered":"[Obj-C] \u30e1\u30bd\u30c3\u30c9\u30d5\u30a1\u30df\u30ea\u30fc"},"content":{"rendered":"<p>Objective-C\u306b\u304a\u3044\u3066\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u306f\u547d\u540d\u898f\u5247\u304c\u6c7a\u307e\u3063\u3066\u3044\u308b\u3002\u3053\u306e\u547d\u540d\u898f\u5247\u3092\u5143\u306b\u51e6\u7406\u7cfb\u304c\u30aa\u30fc\u30ca\u30fc\u30b7\u30c3\u30d7\u30dd\u30ea\u30b7\u30fc\u3092\u5224\u5b9a\u3057\u3066\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306e\u8b66\u544a\u3084\u30a8\u30e9\u30fc\u3092\u5224\u5b9a\u3059\u308b\u305f\u3081\u6ce8\u610f\u3059\u308b\u3053\u3068\u3002Swift\u304b\u3089Objective-C\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3057\u305f\u3068\u304d\u3082\u3001\u4e0b\u8a18\u306e\u300e\u30e1\u30bd\u30c3\u30c9\u30d5\u30a1\u30df\u30ea\u30fc\u300f\u304c\u5f71\u97ff\u3059\u308b\u3002<\/p>\n<p><!--more--><\/p>\n<h1>\u30e1\u30bd\u30c3\u30c9\u30d5\u30a1\u30df\u30ea\u30fc\u3068\u306f<\/h1>\n<dl>\n<dt>\u30aa\u30fc\u30ca\u30fc\u30b7\u30c3\u30d7\u30dd\u30ea\u30b7\u30fc (ownership policy)<\/dt>\n<dd>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u6240\u6709\u8005\u304c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u89e3\u653e\u306b\u8cac\u4efb\u3092\u6301\u3064\u305f\u3081\u306e\u53d6\u308a\u6c7a\u3081\u3002retain\/release\u3059\u308b\u8cac\u4efb\u304c\u3069\u3061\u3089\u306b\u3042\u308b\u306e\u304b\u306e\u53d6\u308a\u6c7a\u3081\u3002<\/dd>\n<\/dl>\n<dl>\n<dt>\u30e1\u30bd\u30c3\u30c9\u30d5\u30a1\u30df\u30ea\u30fc (method family)<\/dd>\n<dd>\u30aa\u30fc\u30ca\u30fc\u30b7\u30c3\u30d7\u30dd\u30ea\u30b7\u30fc\u3092\u30b3\u30f3\u30d1\u30a4\u30e9\u304c\u660e\u78ba\u306b\u533a\u5225\u3059\u308b\u305f\u3081\u306e\u65b9\u6cd5<\/dd>\n<\/dl>\n<ul>\n<li><b>init<\/b>&#8230;, <b>new<\/b>&#8230; \u3067\u59cb\u307e\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3057\u305f\u3068\u304d<\/li>\n<li><b>copy<\/b>&#8230;, <b>mutableCopy<\/b>&#8230; \u3067\u59cb\u307e\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u8907\u88fd\u3057\u305f\u3068\u304d<\/li>\n<\/ul>\n<p>\u8fd4\u3055\u308c\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u5bfe\u3059\u308b\u30aa\u30fc\u30ca\u30fc\u30b7\u30c3\u30d7\uff08\u6240\u6709\u6a29\uff09\u304c\u767a\u751f\u3059\u308b\u3002<br \/>\n<!--more--><\/p>\n<p>&nbsp;<\/p>\n<h2>\u4e0d\u9069\u5207\u306a\u30bb\u30ec\u30af\u30bf\u30fc\uff08\u30e1\u30bd\u30c3\u30c9\u540d\uff09\u306e\u4f8b<\/h2>\n<ul>\n<li>newLine<\/li>\n<li>copyRight<\/li>\n<\/ul>\n<p>new\u3084copy\u3092\u7121\u95a2\u4fc2\u306a(release\u306e\u5fc5\u8981\u306e\u306a\u3044\u53c2\u7167\u3092\u8fd4\u5374\u3059\u308b)\u30bb\u30ec\u30af\u30bf\u30fc\u306e\u5148\u982d\u306b\u3064\u304b\u3063\u3066\u306f\u3044\u3051\u306a\u3044<\/p>\n<p>&nbsp;<\/p>\n<h2>init\u30d5\u30a1\u30df\u30ea\u30fc\u306e\u30bb\u30ec\u30af\u30bf\u30fc<\/h2>\n<ul>\n<li>init<\/li>\n<li>initToMemory<\/li>\n<li>initWithData:<\/li>\n<li>_init:locale:<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>init\u30d5\u30a1\u30df\u30ea\u30fc\u3068\u3057\u3066\u306e\u6761\u4ef6\u3092\u6e80\u305f\u3055\u306a\u3044\u30bb\u30ec\u30af\u30bf\u30fc<\/h2>\n<ul>\n<li>initialize &#8212; init\u306e\u6b21\u304c\u5c0f\u6587\u5b57 i<\/li>\n<li>initwithString:locale: &#8212; init\u306e\u6b21\u304c\u5c0f\u6587\u5b57 w<\/li>\n<li>do_initWithData: &#8212; init\u304c\u5148\u982d\u306b\u306a\u3044<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h1>\u30e1\u30bd\u30c3\u30c9\u30d5\u30a1\u30df\u30ea\u30fc\u306b\u5f93\u308f\u306a\u3044\u3068\u304d\u306b\u767a\u751f\u3059\u308b\uff08\u9759\u7684\u30b3\u30fc\u30c9\u89e3\u6790\uff09\u30a8\u30e9\u30fc\u306e\u4f8b<\/h1>\n<h2>Potential leak of an object stored into &#8216;xxx&#8217;<\/h2>\n<blockquote><p>\nObject leaked: object allocated and stored into &#8216;xxx&#8217; is returned from a method whose name &#8216;xxx:xxx:&#8217;) does not start with &#8216;copy&#8217;, &#8216;mutableCopy&#8217;, alloc&#8217; or &#8216;new&#8217;. this violations the naming convention rules given in the Memory Management Guide for Cocoa\n<\/p><\/blockquote>\n<p>\u30e1\u30bd\u30c3\u30c9\u306e\u4e2d\u3067CGCreateImage()\u306a\u3069\u306b\u3088\u308a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3001\u305d\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3078\u306e\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3092\u5909\u6570\u306a\u3069\u3067\u547c\u3073\u51fa\u3057\u5143\u306b\u8fd4\u3059\u3068\u304d\u3001\u30e1\u30bd\u30c3\u30c9\u540d\u306f &#8216;copy&#8217;, &#8216;mutableCopy&#8217;, &#8216;alloc&#8217;, &#8216;new&#8217; \u306e\u3044\u305a\u308c\u304b\u306e\u63a5\u982d\u8f9e\u3067\u521d\u3081\u3066\u3001\u547c\u3073\u51fa\u3057\u5143\u3067\u89e3\u653e\u304c\u5fc5\u8981\u306a\u3053\u3068\u3092\u660e\u78ba\u306b\u3059\u308b\u3053\u3068\u304c\u6c42\u3081\u3089\u308c\u308b\u3002\u4e0d\u9069\u5207\u306a\u30e1\u30bd\u30c3\u30c9\u540d\u3092\u3064\u3051\u305f\u3068\u304d\u306f release \u304c\u5fc5\u8981\u306a\u53c2\u7167\u3092\u95a2\u6570\u304c\u8fd4\u5374\u3059\u308b\u30b3\u30fc\u30c9\u306b\u5bfe\u3057\u3066\u8b66\u544a\u304c\u8868\u793a\u3055\u308c\u308b\u3002<\/p>\n<h3>\u4e0d\u9069\u5207\u306a\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3057\u305f\u5074\u3067\u767a\u751f\u3059\u308b\u8b66\u544a<\/h3>\n<blockquote><p>\nIncorrect decrement of the reference count of an object that is not owned at this point by the caller\n<\/p><\/blockquote>\n<p>xxxRelease()\u304c\u5fc5\u8981\u3060\u304c\uff08\u51e6\u7406\u7cfb\u306b\u3088\u308a\uff09\u8a8d\u77e5\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u9759\u7684\u89e3\u6790\u30c4\u30fc\u30eb(Analyzer)\u304c\u8b66\u544a\u3092\u767a\u3057\u3066\u3044\u308b<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Objective-C\u306b\u304a\u3044\u3066\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u306f\u547d\u540d\u898f\u5247\u304c\u6c7a\u307e\u3063\u3066\u3044\u308b\u3002\u3053\u306e\u547d\u540d\u898f\u5247\u3092\u5143\u306b\u51e6\u7406\u7cfb\u304c\u30aa\u30fc\u30ca\u30fc\u30b7\u30c3\u30d7\u30dd\u30ea\u30b7\u30fc\u3092\u5224\u5b9a\u3057\u3066\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306e\u8b66\u544a\u3084\u30a8\u30e9\u30fc\u3092\u5224\u5b9a\u3059\u308b\u305f\u3081\u6ce8\u610f\u3059\u308b\u3053\u3068\u3002Swift\u304b\u3089Obj [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[28],"class_list":["post-1296","post","type-post","status-publish","format-standard","hentry","category-memo","tag-objective-c"],"_links":{"self":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/1296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/comments?post=1296"}],"version-history":[{"count":18,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/1296\/revisions"}],"predecessor-version":[{"id":2335,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/1296\/revisions\/2335"}],"wp:attachment":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/media?parent=1296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/categories?post=1296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/tags?post=1296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}