{"id":3347,"date":"2017-07-15T13:29:06","date_gmt":"2017-07-15T04:29:06","guid":{"rendered":"http:\/\/ukaapple.selfip.com\/support\/?p=3347"},"modified":"2017-09-02T20:34:41","modified_gmt":"2017-09-02T11:34:41","slug":"swift_update_day1_4","status":"publish","type":"post","link":"https:\/\/minnano.app\/support\/2017\/07\/15\/swift_update_day1_4\/","title":{"rendered":"\u5b9f\u9332! 2\u5e74\u534a\u3076\u308a\u306eSwift\u30a2\u30d7\u30ea\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7 1\u65e5\u76ee \u305d\u306e4"},"content":{"rendered":"<p>\u7d9a\u304d\u3067\u3059\u3002<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\nExtra argument &#8216;error&#8217; in call<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nfileManager.removeItemAtPath(pngPath, error: nil)<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\ndo {                                                    \/\/ 3.1<br \/>\n    try fileManager.removeItem(atPath: pngPath)         \/\/ 3.1<br \/>\n} catch {                                               \/\/ 3.1<br \/>\n    print(&#8220;removeItem error&#8221;)                           \/\/ 3.1<br \/>\n}                                                       \/\/ 3.1<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\n\u30a8\u30e9\u30fc\u51e6\u7406\u304c\u5909\u308f\u308a\u307e\u3057\u305f\u3002\u4eca\u5f8c\u306ftry catch\u3067\u7d71\u4e00\u3059\u308b\u3093\u3067\u3059\u306d\u3002\u307e\u305f\u3001removeItemAtPath\u306fremoveItem\u306b\u540d\u79f0\u5909\u66f4\u3068\u306a\u308a\u3001\u7b2c\u4e00\u5f15\u6570\u306e\u30e9\u30d9\u30eb\u540datPath\u304c\u5fc5\u9808\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\n&#8216;++&#8217; is unavailable: it has been removed in Swift 3<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nif MAX_HISTORY <= ++gs.m_hisIdx {<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\ngs.m_hisIdx += 1                   \/\/ 3.1<br \/>\nif MAX_HISTORY <= gs.m_hisIdx {    \/\/ 3.1<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\n++\u3084&#8211;\u306e\u6f14\u7b97\u5b50\u306f\u5ec3\u6b62\u3060\u305d\u3046\u3067\u3059\u3002\u308f\u304b\u308a\u306b\u304f\u304f\u306a\u308b\u304b\u3089\u304b\u3057\u3089\u30fb\u30fb\u30fb<br \/>\n\u5909\u6570\u306e\u524d\u306e++\u306f\u8a72\u5f53\u884c\u3088\u308a\u524d\u3067\u3001\u5909\u6570\u306e\u5f8c\u306e++\u306f\u8a72\u5f53\u884c\u3088\u308a\u5f8c\u3067\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3057\u307e\u3059\u3002\u30c7\u30af\u30ea\u30e1\u30f3\u30c8\u3082\u540c\u69d8\u3067\u3059\u3002<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\n&#8216;bytes&#8217; is unavailable: use withUnsafeBytes instead<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nvar buffer : UnsafePointer<UInt8> = CFDataGetBytePtr(dataRef)<br \/>\nmemcpy(&#038;gs.m_buffer, Data(bytes: UnsafePointer<UInt8>(buffer), count : newX * newY * 4).bytes, newX * newY * 4)<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\nvar buffer : UnsafePointer<UInt8> = CFDataGetBytePtr(dataRef)<br \/>\nmemcpy(&#038;gs.m_buffer, buffer, newX * newY * 4)<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\n\u30a8\u30e9\u30fc\u306e\u76f4\u63a5\u306e\u89e3\u8aac\u3067\u306f\u306a\u3044\u3067\u3059\u3002withUnsafeBytes\u3092\u4f7f\u3046\u4ee5\u524d\u306b\u3001\u306a\u3093\u3067\u4e00\u65e6Data\u578b\u306b\u5909\u63db\u3057\u3066\u305f\u3093\u3060\u308d\u3046\u30fb\u30fb\u30fb<br \/>\n\u76f4\u63a5 UnsafePointer<UInt8> \u3092memcpy\u306e\u5f15\u6570\u306b\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u30a8\u30e9\u30fc\u3092\u56de\u907f\u3002\u52d5\u304f\u304b\u306a\u3041\u30fb\u30fb\u30fb<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\nNSString&#8217; is not implicitly convertible to &#8216;String&#8217;; did you mean to use &#8216;as&#8217; to explicitly convert?<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nlet path = paths1[0].stringByAppendingPathComponent(NSString(format:&#8221;slot%02d.png&#8221;,index))<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\nlet path = paths1[0].stringByAppendingPathComponent(String(format:&#8221;slot%02d.png&#8221;,index)) \/\/ 3.1<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\n\u30a8\u30e9\u30fc\u306e\u610f\u5473\u306f\u300cNSString\u306f\u6697\u9ed9\u7684\u306bString\u3078\u5909\u63db\u3067\u304d\u306a\u3044\u3088\uff1f&#8217;as&#8217;\u4f7f\u3063\u3066\u660e\u793a\u7684\u306b\u5909\u63db\u3057\u305f\u3089\uff1f\u300d\u3067\u3059\u3002stringByAppendingPathComponent\u306e\u5f15\u6570\u306fString\u3067\u3059\u304c\u3001\u305d\u3053\u306bNSString\u3092\u6307\u5b9a\u3057\u305f\u306e\u3067\u3053\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u3066\u3044\u307e\u3059\u3002String\u306b\u3082format\u304c\u3042\u308b\u306e\u3067\u305d\u308c\u3092\u4f7f\u3046\u3088\u3046\u306b\u3057\u3001NSString\u3092\u4f7f\u308f\u306a\u3044\u3088\u3046\u306b\u5bfe\u51e6\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\nGameViewController.swift:109:19: Method does not override any method from its superclass<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\noverride func supportedInterfaceOrientations() -> Int {<br \/>\n    if UIDevice.current.userInterfaceIdiom == .phone {<br \/>\n        return Int(UIInterfaceOrientationMask.allButUpsideDown.rawValue)<br \/>\n    } else {<br \/>\n        return Int(UIInterfaceOrientationMask.all.rawValue)<br \/>\n    }<br \/>\n}<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\noverride var supportedInterfaceOrientations : UIInterfaceOrientationMask {<br \/>\n    if UIDevice.current.userInterfaceIdiom == .phone {<br \/>\n        return UIInterfaceOrientationMask.allButUpsideDown<br \/>\n    } else {<br \/>\n        return UIInterfaceOrientationMask.all<br \/>\n    }<br \/>\n}<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\n\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u308b\u753b\u9762\u306e\u5411\u304d\u3092\u8fd4\u3059\u30e1\u30bd\u30c3\u30c9 supportedInterfaceOrientations \u306e\u5b9a\u7fa9\u304c\u5909\u308f\u3063\u305f\u3088\u3046\u3067\u3059\u3002\u623b\u308a\u5024\u3082\u5909\u308f\u3063\u3066\u308b\u306e\u3067\u3001\u305d\u308c\u306b\u5408\u308f\u305b\u3066return\u306e\u5185\u5bb9\u3082\u8abf\u6574\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011<br \/>\n&#8216;CGContextSetLineDash&#8217; is unavailable: Use setLineDash(self:phase:lengths:)<br \/>\n\u3010\u4fee\u6b63\u524d\u3011<br \/>\nCGContextSetLineDash(UIGraphicsGetCurrentContext(), 0, len, len.count)<br \/>\n\u3010\u4fee\u6b63\u5f8c\u3011<br \/>\nUIGraphicsGetCurrentContext()?.setLineDash(phase: 0.0, lengths: len)        \/\/ 3.1<br \/>\n\u3010\u89e3\u8aac\u3011<br \/>\n\u305d\u308d\u305d\u308d\u75b2\u308c\u3066\u304d\u307e\u3057\u305f \u2190\u89e3\u8aac\u306b\u306a\u3063\u3066\u306a\u3044<br \/>\n2\u5e74\u534a\u3076\u308a\u306eSwift\u306a\u306e\u3067\u3001\u30aa\u30d7\u30b7\u30e7\u30ca\u30eb\u578b\u3068\u304b\u30a2\u30f3\u30e9\u30c3\u30d7\u3068\u304b\u306e\u77e5\u8b58\u3092\u4ed8\u3051\u76f4\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u4eca\u65e5\u306f\u3082\u3046\u5bdd\u307e\u3059\u3002\u3055\u3088\u3046\u306a\u30892017\u5e747\u670815\u65e5\u3002<\/p>\n<p>\u30fb\u30fb\u30fb<a href=\"\/support\/index.php\/2017\/07\/16\/swift_update_day2\/\">\u7d9a\u304f<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7d9a\u304d\u3067\u3059\u3002 \u3010\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3011 Extra argument &#8216;error&#8217; in call \u3010\u4fee\u6b63\u524d\u3011 fileManager.removeItemAtPath(pngPath, error: &hellip; <a href=\"https:\/\/minnano.app\/support\/2017\/07\/15\/swift_update_day1_4\/\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">\u5b9f\u9332! 2\u5e74\u534a\u3076\u308a\u306eSwift\u30a2\u30d7\u30ea\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7 1\u65e5\u76ee \u305d\u306e4<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-3347","post","type-post","status-publish","format-standard","hentry","category-dotter"],"_links":{"self":[{"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/posts\/3347","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/comments?post=3347"}],"version-history":[{"count":1,"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/posts\/3347\/revisions"}],"predecessor-version":[{"id":4005,"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/posts\/3347\/revisions\/4005"}],"wp:attachment":[{"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/media?parent=3347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/categories?post=3347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/minnano.app\/support\/wp-json\/wp\/v2\/tags?post=3347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}