{"id":1017,"date":"2016-07-27T18:41:24","date_gmt":"2016-07-27T09:41:24","guid":{"rendered":"http:\/\/www.chihayafuru.jp\/tech\/?p=1017"},"modified":"2021-06-04T17:10:20","modified_gmt":"2021-06-04T08:10:20","slug":"cannot-jump-from-switch-statement-to-this-case-label","status":"publish","type":"post","link":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/archives\/1017","title":{"rendered":"[Objective-C] Cannot jump from switch statement to this case label"},"content":{"rendered":"<h3>1. \u75c7\u72b6<\/h3>\n<p>Objective-C \u306e switch\u69cb\u6587\u306e\u5185\u5074\u3067\u30d6\u30ed\u30c3\u30af\u3092\u5b9a\u7fa9\u3059\u308b\u3068\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc &quot;<strong>Cannot jump from switch statement to this case label<\/strong>&quot; \u304c\u767a\u751f\u3059\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>2. \u5bfe\u7b56<\/h3>\n<p>case\u6587\u306e\u5185\u5074\u3092 { } \u3067\u62ec\u308b\u3002<\/p>\n<p><!--more--><\/p>\n<h4>2.1. \u4fee\u6b63\u524d<\/h4>\n<pre class=\"lang:objc decode:true \" >switch (flag) {\r\n  case 1:\r\n    [aObject completion: ^{\r\n      NSLog(\"1 is selected\");\r\n    }];\r\n    break;\r\n  case 2:  \/\/ \u2190 Cannot jump from switch statement to this case label\r\n    [aObject completion: ^{\r\n      NSLog(\"2 is selected\");\r\n    }];\r\n    break;\r\n  default;\r\n    [aObject completion: ^{\r\n      NSLog(\"Anything is not selected\");\r\n    }];\r\n    break;\r\n}<\/pre>\n<h4>2.2. \u4fee\u6b63\u5f8c<\/h4>\n<pre class=\"lang:objc decode:true \" >switch (flag) {\r\n  case 1:\r\n  {\r\n    [aObject completion: ^{\r\n      NSLog(\"1 is selected\");\r\n    }];\r\n    break;\r\n  }\r\n  case 2:\r\n  {\r\n    [aObject completion: ^{\r\n      NSLog(\"2 is selected\");\r\n    }];\r\n    break;\r\n  }\r\n  default;\r\n  {\r\n    [aObject completion: ^{\r\n      NSLog(\"Anything is not selected\");\r\n    }];\r\n    break;\r\n  }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h3>3. \u95a2\u9023\u9805\u76ee<\/h3>\n<ul>\n<li><a href=\"\/tech\/index.php\/archives\/2990\">[C\u8a00\u8a9e] switch\u6587\u306e\u4e2d\u306e\u5909\u6570\u306e\u5b9a\u7fa9\u304c\u30a8\u30e9\u30fc\u3068\u306a\u308b<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1. \u75c7\u72b6 Objective-C \u306e switch\u69cb\u6587\u306e\u5185\u5074\u3067\u30d6\u30ed\u30c3\u30af\u3092\u5b9a\u7fa9\u3059\u308b\u3068\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc &quot;Cannot jump from switch statement to this case label&#038; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[28],"class_list":["post-1017","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\/1017","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=1017"}],"version-history":[{"count":15,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/1017\/revisions"}],"predecessor-version":[{"id":4254,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/1017\/revisions\/4254"}],"wp:attachment":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/media?parent=1017"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/categories?post=1017"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/tags?post=1017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}