{"id":225588,"date":"2017-10-17T16:07:42","date_gmt":"2017-10-17T08:07:42","guid":{"rendered":"http:\/\/magicalbits.net\/?p=225588"},"modified":"2017-10-17T16:07:42","modified_gmt":"2017-10-17T08:07:42","slug":"%e5%85%b3%e4%ba%8e-swift-error-%e7%9a%84%e5%88%86%e7%b1%bb","status":"publish","type":"post","link":"https:\/\/magicalbits.net\/?p=225588","title":{"rendered":"\u5173\u4e8e Swift Error \u7684\u5206\u7c7b"},"content":{"rendered":"<blockquote><p>\u5728\u53bb\u5e74\u6211\u5e94 IBM \u7f16\u8f91\u7684\u9080\u8bf7\u5199\u8fc7\u4e00\u7bc7\u5173\u4e8e Swift 2 \u4e2d throws \u7684\u6587\u7ae0\u3002\u73b0\u5728\u56de\u5934\u770b\uff0cSwift 2 \u5176\u5b9e\u662f Swift \u8bed\u8a00\u53d1\u5c55\u7684\u4e00\u4e2a\u633a\u91cd\u8981\u7684\u8282\u70b9\uff1a\u5982\u679c\u8bf4 Swift 1 \u662f\u4e00\u4e2a\u66f4\u504f\u5411\u4e8e\u9a8c\u8bc1\u9636\u6bb5\u7684\u4ea7\u54c1\u7684\u8bdd\uff0cSwift 2 \u4e2d\u52a0\u5165\u7684\u7279\u6027\u4e3a\u8fd9\u95e8\u8bed\u8a00\u7684\u57fa\u77f3\u8fdb\u884c\u4e86\u8865\u8db3\u3002\u5728\u90a3\u7bc7\u6587\u7ae0\u91cc\u6211\u4eec\u4e3b\u8981\u6df1\u5165\u63a2\u7d22\u4e86\u65b0\u7684 throw \u5173\u952e\u5b57\u80cc\u540e\u7684\u4e8b\u60c5\uff0c\u800c\u540c\u4e00\u65f6\u671f\u5176\u5b9e Swift \u5b98\u65b9\u6709\u8fc7\u4e00\u6b21\u5173\u4e8e\u9519\u8bef\u5904\u7406\u7684\u8ba8\u8bba\u3002\u968f\u7740 Swift 3 \u7684\u5f00\u6e90\uff0c\u8fd9\u4e9b\u539f\u59cb\u6587\u6863\u4e5f\u88ab\u4e00\u540c\u516c\u5f00\uff0c\u5c55\u793a\u4e86 Swift \u8bbe\u8ba1\u7684\u8fc7\u7a0b\u548c\u8f68\u8ff9\u3002\u5982\u679c\u4f60\u5bf9\u8fd9\u7bc7 Swift 2 \u4e2d\u7684\u9519\u8bef\u5904\u7406\u7684\u5ba3\u8a00\u611f\u5174\u8da3\u7684\u8bdd\uff0c\u53ef\u4ee5\u5728 GitHub \u4e0a Swift \u9879\u76ee\u6587\u6863\u4e2d\u627e\u5230\u539f\u6587\u3002<\/p><\/blockquote>\n<p>Source: <em><a href=\"https:\/\/onevcat.com\/2017\/10\/swift-error-category\/\">\u5173\u4e8e Swift Error \u7684\u5206\u7c7b<\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u53bb\u5e74\u6211\u5e94 IBM \u7f16\u8f91\u7684\u9080\u8bf7\u5199\u8fc7\u4e00\u7bc7\u5173\u4e8e Swift 2 \u4e2d throws \u7684\u6587\u7ae0\u3002\u73b0\u5728\u56de\u5934\u770b\uff0cSwift 2 \u5176\u5b9e\u662f Swift \u8bed\u8a00\u53d1\u5c55\u7684\u4e00\u4e2a\u633a\u91cd\u8981\u7684\u8282\u70b9\uff1a\u5982\u679c\u8bf4 Swift 1 \u662f\u4e00\u4e2a\u66f4\u504f\u5411\u4e8e\u9a8c\u8bc1\u9636\u6bb5\u7684\u4ea7\u54c1\u7684\u8bdd\uff0cSwift 2 \u4e2d\u52a0\u5165\u7684\u7279\u6027\u4e3a\u8fd9\u95e8\u8bed\u8a00\u7684\u57fa\u77f3\u8fdb\u884c\u4e86\u8865\u8db3\u3002\u5728\u90a3\u7bc7\u6587\u7ae0\u91cc\u6211\u4eec\u4e3b\u8981\u6df1\u5165\u63a2\u7d22\u4e86\u65b0\u7684 throw \u5173\u952e\u5b57\u80cc\u540e\u7684\u4e8b\u60c5\uff0c\u800c\u540c\u4e00\u65f6\u671f\u5176\u5b9e Swift \u5b98\u65b9\u6709\u8fc7\u4e00\u6b21\u5173\u4e8e\u9519\u8bef\u5904\u7406\u7684\u8ba8\u8bba\u3002\u968f\u7740 Swift 3 \u7684\u5f00\u6e90\uff0c\u8fd9\u4e9b\u539f\u59cb\u6587\u6863\u4e5f\u88ab\u4e00\u540c\u516c\u5f00\uff0c\u5c55\u793a\u4e86 Swift \u8bbe\u8ba1\u7684\u8fc7\u7a0b\u548c\u8f68\u8ff9\u3002\u5982\u679c\u4f60\u5bf9\u8fd9\u7bc7 Swift 2 \u4e2d\u7684\u9519\u8bef\u5904\u7406\u7684\u5ba3\u8a00\u611f\u5174\u8da3\u7684\u8bdd\uff0c\u53ef\u4ee5\u5728 GitHub \u4e0a Swift \u9879\u76ee\u6587\u6863\u4e2d\u627e\u5230\u539f\u6587\u3002 Source: \u5173\u4e8e Swift Error \u7684\u5206\u7c7b<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ep_exclude_from_search":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-225588","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/magicalbits.net\/index.php?rest_route=\/wp\/v2\/posts\/225588","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/magicalbits.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/magicalbits.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/magicalbits.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/magicalbits.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=225588"}],"version-history":[{"count":1,"href":"https:\/\/magicalbits.net\/index.php?rest_route=\/wp\/v2\/posts\/225588\/revisions"}],"predecessor-version":[{"id":225589,"href":"https:\/\/magicalbits.net\/index.php?rest_route=\/wp\/v2\/posts\/225588\/revisions\/225589"}],"wp:attachment":[{"href":"https:\/\/magicalbits.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=225588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/magicalbits.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=225588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/magicalbits.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=225588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}