{"id":3799,"date":"2015-05-09T00:20:32","date_gmt":"2015-05-08T16:20:32","guid":{"rendered":"http:\/\/benjenq.ddns.net\/blog\/%e3%80%90%e7%a2%bc%e8%be%b2%e3%80%91%e6%92%b0%e5%af%ab%e7%ac%ac%e4%b8%80%e6%94%af-apple-watch-%e7%a8%8b%e5%bc%8f\/"},"modified":"2015-05-09T00:20:32","modified_gmt":"2015-05-08T16:20:32","slug":"%e3%80%90%e7%a2%bc%e8%be%b2%e3%80%91%e6%92%b0%e5%af%ab%e7%ac%ac%e4%b8%80%e6%94%af-apple-watch-%e7%a8%8b%e5%bc%8f","status":"publish","type":"post","link":"http:\/\/benjenq.ddns.net\/blog\/%e3%80%90%e7%a2%bc%e8%be%b2%e3%80%91%e6%92%b0%e5%af%ab%e7%ac%ac%e4%b8%80%e6%94%af-apple-watch-%e7%a8%8b%e5%bc%8f\/","title":{"rendered":"\u3010\u78bc\u8fb2\u3011\u64b0\u5beb\u7b2c\u4e00\u652f Apple Watch \u7a0b\u5f0f"},"content":{"rendered":"<p>\u6709\u5728\u6301\u7e8c\u95dc\u6ce8\u9ed1\u860b\u679c\u8b70\u984c\u7684\u7528\u6236\u61c9\u8a72\u53ef\u4ee5\u89c0\u5bdf\u5230\uff0c\u7528\u9ed1\u860b\u679c\u7684\u4eba\u8d8a\u4f86\u8d8a\u591a\u4e86\uff0c\u9023\u67d0\u71b1\u9580\u7684\u5c4b\u8ce3\u5834\u751a\u81f3\u9084\u958b\u8a2d\u300c\u9ed1\u860b\u679c\u5957\u9910\u300d\u4f86\u6e1b\u5c11\u7528\u6236\u9078\u8cfc\u6642\u7684\u9ebb\u7169\u3002\u9019\u4ee3\u8868\u5b89\u88dd\u9ed1\u860b\u679c\u7684\u96e3\u5ea6\u8d8a\u4f86\u8d8a\u4f4e\uff0c\u4f9d ING \u539f\u5247\u9078\u8cfc\u786c\u9ad4\u4e4b\u5f8c\uff0c\u518d\u627e\u53f0 OS X \u96fb\u8166\u641e\u5b9a\u4e00\u652f USB \u5b89\u88dd\u789f\uff0c\u5c31\u5dee\u4e0d\u591a\u53ef\u4ee5\u958b\u59cb\u5543\u9ed1\u860b\u679c\u4e86\u3002\u7db2\u8def\u4e0a\u7684\u9ed1\u8cc7\u6e90\u8d8a\u4f86\u8d8a\u591a\uff0c\u4e5f\u4e0d\u7f3a\u6211\u500b\u4eba\u5beb\u9ed1\u5c08\u984c\uff0c\u6240\u4ee5\u73fe\u5728\u4f86\u63db\u63db\u53e3\u5473\uff0c\u804a\u804a\u76ee\u524d\u8edf\u9ad4\u958b\u767c\u754c\u6700\u592f\u7684\u8a71\u984c\uff1aApple Watch \u7684 APP \u958b\u767c\u3002<\/p>\n<p><img decoding=\"async\" title=\"Watch_iPhone\" src=\"http:\/\/pic.pimg.tw\/benjenq\/1431468884-1352755413.png\" alt=\"Watch_iPhone\" border=\"0\"> &nbsp;&nbsp; &nbsp;&nbsp;<\/p>\n<p>\u6700\u65e9\u5927\u5bb6\u7684\u731c\u6e2c\u662f\uff0cApple Watch \u7684 APP \u53ef\u80fd\u662f\u4e00\u500b\u7368\u7acb\u7684\u5e73\u53f0\uff0c\u4e5f\u6709\u4eba\u731c\u6e2c Apple Watch APP \u53ef\u80fd\u6709\u5c08\u5c6c\u7684 Watch APP Store\uff0c\u4e0d\u904e\u76f4\u5230\u76f8\u95dc\u7d30\u7bc0\u6b63\u5f0f\u516c\u958b\u4ecb\u7d39\uff0c\u5927\u5bb6\u624d\u6f38\u6f38\u5f97\u77e5 Apple Watch \u53ea\u662f iPhone \u7684\u4e00\u9805\u9644\u5c6c\u578b\u7684\u7522\u54c1\u3002\u53ef\u662f\uff0c\u5230\u5e95\u662f\u600e\u6a23\u7684\u9644\u5c6c\u65b9\u5f0f\u5462\uff1f\u5176\u5be6\u5f9e\u958b\u767c\u8005\u7684\u89d2\u5ea6\uff0c\u4f86\u5617\u8a66\u958b\u767c Apple Watch APP \uff0c\u5c31\u80fd\u5f88\u5feb\u5730\u7406\u89e3\u4e86\u3002<\/p>\n<\/p>\n<p><!-- more -->\u8981\u64b0\u5beb Apple Watch APP \u4e4b\u524d\uff0c\u5148\u4e86\u89e3\u4ec0\u9ebc\u53eb\u505a Application Extension\u3002&nbsp;<\/p>\n<p>Application Extension \u662f iOS8 \u4ee5\u5f8c\u7684\u4e00\u500b\u65b0\u7684 APP \u985e\u578b\u3002\u5728 iOS7 \u4ee5\u524d\uff0cAPP \u7684\u904b\u884c\u689d\u4ef6\uff0c\u5e7e\u4e4e\u90fd\u88ab\u9650\u5236\u5728\u4e00\u500b\u53eb\u505a\u300c\u6c99\u7bb1\u300d\uff08Sandbox\uff09\u7684\u74b0\u5883\u4e0b\u3002\u5f9e iOS8 \u958b\u59cb\uff0c\u860b\u679c\u958b\u653e APP \u53ef\u4ee5\u6709\u689d\u4ef6\u7684\u5728\u67d0\u4e9b\u5176\u4ed6\u5730\u65b9\u904b\u4f5c\uff0c\u9664\u4e86\u57fa\u672c\u7684\u6c99\u7bb1\u4e4b\u5916\uff0c\u4e5f\u53ef\u5728\u901a\u77e5\u4e2d\u5fc3\u3001\u63a7\u5236\u4e2d\u5fc3\u3001\u9375\u76e4\u3001\u7167\u7247\u7de8\u8f2f\u3001\u5206\u4eab\u63a7\u5236\u53f0\u7b49\u9019\u4e9b\u5730\u65b9\u904b\u884c\uff0c\u9019\u4e9b\u5730\u65b9\u53ef\u8996\u70ba APP \u7684\u5ef6\u4f38\uff0c\u7d71\u7a31\u70ba&nbsp;Application&nbsp;Extension \uff0c\u4e0d\u540c\u7684\u5730\u65b9\u6709\u4e0d\u540c\u7684\u985e\u578b\u8207\u7d44\u614b\u5b9a\u7fa9\u3002\u800c\u6bcf\u4e00\u500b\u904b\u4f5c\u7684 Extension \u53ef\u8996\u70ba\u53e6\u4e00\u500b\u5c0f\u578b APP \uff0c\u5b83\u5fc5\u9808\u4f9d\u9644\u5728\u672c\u4f86\u7684 APP \u88e1\uff0c\u4e0d\u80fd\u7368\u7acb\u5b58\u5728\u3002\u5c0d\u672c\u4f86\u7684&nbsp;APP \u4f86\u8aaa\uff0c\u53ea\u9700\u52a0\u639b\u5c0d\u61c9\u7684 Extension \u7d44\u614b\u5c31\u80fd\u652f\u63f4\u3002<\/p>\n<p><img decoding=\"async\" title=\"ExtensionDemo\" src=\"http:\/\/pic.pimg.tw\/benjenq\/1431188315-4153049263.png?v=1431188317\" alt=\"ExtensionDemo\" border=\"0\"> &nbsp;<\/p>\n<p>\u5f9e iOS 8.3 \u958b\u59cb\uff0cExtension \u53c8\u591a\u4e86\u4e00\u500b\u985e\u578b\uff0c\u6c92\u932f\uff01\u5c31\u662f Apple Watch\u3002\u63db\u8a00\u4e4b\uff0c\u53ea\u8981\u4f60\u5df2\u7d93\u4e86\u89e3 iOS8 \u958b\u767c\u64b0\u5beb Extension \u7684\u65b9\u6cd5\uff0c\u90a3\u9ebc\u958b\u767c\u4e00\u652f Apple Watch APP \u5c31\u662f\u4e00\u4ef6\u8f15\u800c\u6613\u8209\u7684\u4e8b\u3002\u4e5f\u56e0\u70ba Application Extension \u7684\u7279\u6027\uff0c\u958b\u767c\u8005\u5b8c\u5168\u4e0d\u9700\u8003\u616e Apple Watch \u8207 iPhone \u4e4b\u9593\u7684\u6e9d\u901a\u554f\u984c\u3002\u800c\u9019\u4e5f\u89e3\u91cb\u4e86\uff0c\u70ba\u4f55 Apple Watch APP \u662f iPhone \u7684\u9644\u5c6c\u54c1\uff0c\u56e0\u70ba\u5b83\u5c31\u53ea\u662f\u500b Application Extension\uff0c\u5fc5\u9808\u4f9d\u9644\u5728\u539f iOS (iPhone) APP \u624d\u80fd\u904b\u4f5c\u3002<\/p>\n<p>\u597d\u4e86\uff5e\u4e0d\u8b1b\u5ee2\u8a71\u4e86&#8230;\u5148\u5f9e\u5982\u4f55\u64b0\u5beb Apple Watch APP \u8aaa\u8d77\u3002\u9996\u5148\u4f60\u9700\u8981\u7684\u662f\uff1a<\/p>\n<ul>\n<li>\u4e00\u53f0\u904b\u884c OS X 10.10 \u4ee5\u4e0a\u7684\u96fb\u8166<\/li>\n<li>\u5f9e <a href=\"https:\/\/itunes.apple.com\/tw\/app\/xcode\/id497799835?l=zh&amp;mt=12\" target=\"_blank\">Mac App Store \u4e0b\u8f09 XCode 6.3<\/a> (\u4ee5\u4e0a)<\/li>\n<li>Apple iOS Developer \u958b\u767c\u8005\u5e33\u865f\uff1a\u5efa\u8b70\u9078\u9805\uff0c\u67d0\u4e9b\u9032\u968e\u7684\u61c9\u7528\u9700\u8981\u9019\u500b\u6b0a\u9650\u3002<\/li>\n<\/ul>\n<p>\u7136\u5f8c\u958b\u59cb\u4f86\u5beb\u7b2c\u4e00\u96bb Apple Watch \u7a0b\u5f0f\u3002<\/p>\n<p>1. \u6253\u958b XCode\uff0cFile -&gt;New -&gt; Project\uff0c\u9078\u500b\u5408\u9069\u7684 APP \u985e\u578b\uff08\u4ee5 Single View Application \u70ba\u4f8b \uff09\uff0cNext<\/p>\n<p><img decoding=\"async\" title=\"XCode_1\" src=\"http:\/\/pic.pimg.tw\/benjenq\/1431105640-2420592186.png?v=1431105643\" alt=\"XCode_1\" border=\"0\"> &nbsp;<\/p>\n<p><img decoding=\"async\" title=\"XCode_2\" src=\"http:\/\/pic.pimg.tw\/benjenq\/1431105783-4116864901.png\" alt=\"XCode_2\" border=\"0\"> &nbsp;<\/p>\n<p>Next -&gt; Create\uff0c\u5efa\u7acb APP \u5c08\u6848\uff0c\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" title=\"XCode_3\" src=\"http:\/\/pic.pimg.tw\/benjenq\/1431105912-2698900971.png\" alt=\"XCode_3\" border=\"0\"> &nbsp;<\/p>\n<p>2. \u63a5\u8457\u518d\u5efa\u7acb\u4e00\u500b Apple Watch Extension \u578b\u7684 Target\u3002\u5c07\u9078\u64c7\u5668\u9ede\u5728\u5c08\u6848\u540d\u7a31\u4e0a\uff0c\u518d\u9ede\u9078\u529f\u80fd\u8868 File -&gt; New -&gt; Target<\/p>\n<p><img decoding=\"async\" title=\"XCode_4\" src=\"http:\/\/pic.pimg.tw\/benjenq\/1431106278-3643571764.png\" alt=\"XCode_4\" border=\"0\"> &nbsp;<\/p>\n<p>\u9078 Apple Watch -&gt; WatchKit App -&gt; Next<\/p>\n<p><img decoding=\"async\" title=\"XCode_5\" src=\"http:\/\/pic.pimg.tw\/benjenq\/1431106371-1412989816.png?v=1431106381\" alt=\"XCode_5\" border=\"0\"> &nbsp;<\/p>\n<p>\u300cInclude Notification Scene\u300d\u53d6\u6d88\u6253\u52fe\uff0cFinish \u5b8c\u6210\u3002<\/p>\n<p><img decoding=\"async\" title=\"XCode_6\" src=\"http:\/\/pic.pimg.tw\/benjenq\/1431106424-3651618922.png\" alt=\"XCode_6\" border=\"0\"> &nbsp;<\/p>\n<p>\u9078 Activate&nbsp;<\/p>\n<p><img decoding=\"async\" title=\"XCode_7\" src=\"http:\/\/pic.pimg.tw\/benjenq\/1431106553-538609318.png\" alt=\"XCode_7\" border=\"0\"> &nbsp;<\/p>\n<p>\u9019\u6a23\uff0c\u6700\u539f\u59cb\u7684 Apple Watch App \u5c31\u5b8c\u6210\u4e86\u3002<\/p>\n<p><img decoding=\"async\" title=\"XCode_8\" src=\"http:\/\/pic.pimg.tw\/benjenq\/1431107247-198679894.png\" alt=\"XCode_8\" border=\"0\"> &nbsp;<\/p>\n<p>\u63a5\u8457\uff0c\u7528\u6700\u5feb\u901f\u7684\u65b9\u5f0f\u628a IBOutLet \u8207 IBAction \u62c9\u4e00\u62c9\uff0c\u88dc\u4e0a SayHello \u7684\u7a0b\u5e8f\u3002<\/p>\n<p><img decoding=\"async\" title=\"XCode_9\" src=\"http:\/\/pic.pimg.tw\/benjenq\/1431107959-4111540197.png\" alt=\"XCode_9\" border=\"0\"> &nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u6a21\u64ec\u5668\u57f7\u884c\uff0c\u8a18\u5f97\u628a\u6a21\u64ec\u5668\u7684 External Displays \u6253\u958b\uff0c\u9019\u6a23 Apple Watch \u7684\u756b\u9762\u624d\u6703\u986f\u793a\u51fa\u4f86<\/p>\n<p><img decoding=\"async\" title=\"Simulator_1\" src=\"http:\/\/pic.pimg.tw\/benjenq\/1431108169-4137714090.png?v=1431108171\" alt=\"Simulator_1\" border=\"0\"> &nbsp;<\/p>\n<p>\u9ede\u64ca Button \uff0cLabel \u6a19\u7c64\u8b8a\u6210 -(IBAction)SayHello \u7684\u57f7\u884c\u7d50\u679c &#8220;Hello World&#8221; \u3002<\/p>\n<p><img decoding=\"async\" title=\"Simulator_2\" src=\"http:\/\/pic.pimg.tw\/benjenq\/1431108276-4286164010.png?v=1431108277\" alt=\"Simulator_2\" border=\"0\"> &nbsp;<\/p>\n<p>Source Code : <a href=\"https:\/\/github.com\/benjenq\/MyHelloAppleWatchApp\" target=\"_blank\">View on Github<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u5728\u6301\u7e8c\u95dc\u6ce8\u9ed1\u860b\u679c\u8b70\u984c\u7684\u7528\u6236\u61c9\u8a72\u53ef\u4ee5\u89c0\u5bdf\u5230\uff0c\u7528\u9ed1\u860b\u679c\u7684\u4eba\u8d8a\u4f86\u8d8a\u591a\u4e86\uff0c\u9023\u67d0\u71b1\u9580\u7684\u5c4b\u8ce3\u5834\u751a\u81f3\u9084\u958b\u8a2d\u300c\u9ed1\u860b\u679c\u5957\u9910\u300d\u4f86 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-container-style":"default","site-container-layout":"default","site-sidebar-layout":"default","disable-article-header":"default","disable-site-header":"default","disable-site-footer":"default","disable-content-area-spacing":"default","footnotes":""},"categories":[51],"tags":[],"class_list":["post-3799","post","type-post","status-publish","format-standard","hentry","category-51"],"_links":{"self":[{"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/posts\/3799","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/comments?post=3799"}],"version-history":[{"count":0,"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/posts\/3799\/revisions"}],"wp:attachment":[{"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/media?parent=3799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/categories?post=3799"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/tags?post=3799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}