{"id":190844,"date":"2022-06-05T01:46:34","date_gmt":"2022-06-04T17:46:34","guid":{"rendered":"https:\/\/www.idc.net\/help\/190844\/"},"modified":"2022-06-05T01:46:34","modified_gmt":"2022-06-04T17:46:34","slug":"%e5%90%8e%e6%b5%aa%e4%ba%91ios%e6%95%99%e7%a8%8b%ef%bc%9a%e4%b8%ba%e4%bd%a0%e7%9a%84-ipad-app-%e5%88%9b%e5%bb%ba-mac-%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/190844\/","title":{"rendered":"\u540e\u6d6a\u4e91IOS\u6559\u7a0b\uff1a\u4e3a\u4f60\u7684 iPad App \u521b\u5efa Mac \u7248\u672c"},"content":{"rendered":"<h2> \u6982\u89c8 <\/h2>\n<p> \u914d\u5408 Xcode 11 \u53ca\u66f4\u9ad8\u7248\u672c\uff0c\u4f60\u80fd\u4f7f\u7528 Mac Catalyst \u6765\u521b\u5efa iPad App \u7684 Mac \u7248\u672c\u3002\u4f60\u53ef\u80fd\u53ea\u9700\u70b9\u6309\u4e00\u4e0b\u590d\u9009\u6846\u5373\u53ef\u5c06\u4f60\u7684 App \u914d\u7f6e\u7528\u4e8e Mac \u914d\u7f6e\uff0c\u4f46\u4e5f\u53ef\u80fd\u9700\u8981\u5b8c\u6210\u66f4\u591a\u6b65\u9aa4\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u4f60\u7684 App \u6240\u4f7f\u7528\u7684\u529f\u80fd\u548c\u6846\u67b6\u3002 <\/p>\n<p> \u6ce8\u91ca <\/p>\n<p> \u6709\u5173\u4e3a\u4f60\u7684 iPad App \u8bbe\u8ba1 Mac \u7248\u672c\u7684\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605\u201c\u4eba\u673a\u754c\u9762\u6307\u5357\u201d\u4e2d\u7684\u201cMac Catalyst\u201d\u3002 <\/p>\n<\/p>\n<h3> \u5c06\u4f60\u7684 App \u914d\u7f6e\u7528\u4e8e Mac <\/h3>\n<p> \u8981\u6dfb\u52a0 Mac \u652f\u6301\uff0c\u8bf7\u6253\u5f00\u4f60\u7684 Xcode \u9879\u76ee\uff0c\u7136\u540e\u9009\u62e9\u4f60\u8981\u914d\u7f6e\u7684 iOS \u76ee\u6807\u3002\u5728\u201cGeneral\u201d(\u901a\u7528) \u6807\u7b7e\u4e2d\uff0c\u9009\u62e9\u201cDeployment Info\u201d(\u90e8\u7f72\u4fe1\u606f) \u4e0b\u7684\u201cMac\u201d\u590d\u9009\u6846\u3002(\u5982\u679c\u4f60\u7684 App \u4ec5\u652f\u6301 iPhone\uff0c\u8fd9\u4e2a\u590d\u9009\u6846\u4e0d\u53ef\u7528\u3002) <\/p>\n<\/p>\n<\/p>\n<p> \u5728\u4f60\u542f\u7528 Mac \u652f\u6301\u540e\uff0cXcode \u4f1a\u5411\u4f60\u7684\u9879\u76ee\u4e2d\u6dfb\u52a0 <code>App \u6c99\u76d2\u6388\u6743<\/code><span><\/span>\u3002Xcode \u53ea\u4f1a\u5c06\u6b64\u6388\u6743\u6dfb\u52a0\u5230 App \u7684 Mac \u7248\u672c\u4e2d\uff0c\u800c\u4e0d\u4f1a\u6dfb\u52a0\u5230 iOS \u7248\u672c\u4e2d\u3002Xcode \u8fd8\u4f1a\u5728\u76ee\u6807\u8bbe\u5907\u5217\u8868\u4e2d\u6dfb\u52a0\u201cMy Mac\u201d(\u6211\u7684 Mac)\u3002\u9009\u62e9\u8fd9\u4e2a\u76ee\u6807\u8bbe\u5907\u5373\u53ef\u4ece Xcode \u8fd0\u884c\u4f60\u7684 Mac App\u3002 <\/p>\n<p> \u8fd9\u65f6\uff0c\u4f60\u6216\u8bb8\u80fd\u591f\u6784\u5efa\u5e76\u8fd0\u884c App \u7684 Mac \u7248\u672c\u3002\u8981\u5c1d\u8bd5\u4e00\u4e0b\uff0c\u53ef\u4ee5\u5c06\u201cMy Mac\u201d(\u6211\u7684 Mac) \u9009\u4e3a\u76ee\u6807\u8bbe\u5907\uff0c\u7136\u540e\u8fd0\u884c\u4f60\u7684\u9879\u76ee\u3002 <\/p>\n<h3> \u5728\u4f7f\u7528\u590d\u9009\u6846\u7684\u57fa\u7840\u4e0a\u66f4\u8fdb\u4e00\u6b65 <\/h3>\n<p> \u5982\u679c\u4f60\u4ecd\u7136\u4e0d\u80fd\u6784\u5efa App \u7684 Mac \u7248\u672c\uff0c\u539f\u56e0\u53ef\u80fd\u662f\uff1a <\/p>\n<ul>\n<li>\n<p> \u4f60\u7684\u9879\u76ee\u5305\u542b\u4e0d\u517c\u5bb9\u7684\u6846\u67b6\u3001\u8d44\u6e90\u5e93\u6216\u5d4c\u5165\u5f0f\u5185\u5bb9\u3002 <\/p>\n<\/li>\n<li>\n<p> \u4f60\u7684\u6e90\u4ee3\u7801\u5f15\u7528\u4e86\u4e0d\u53d7\u652f\u6301\u7684 API\u3002 <\/p>\n<\/li>\n<\/ul>\n<p> \u5728\u4f60\u542f\u7528 Mac \u652f\u6301\u65f6\uff0cXcode \u4f1a\u5c3d\u53ef\u80fd\u4e3a\u4f60\u9879\u76ee\u7684 Mac \u6784\u5efa\u7248\u672c\u81ea\u52a8\u6392\u9664\u4e0d\u517c\u5bb9\u7684\u6846\u67b6\u548c\u5d4c\u5165\u5f0f\u5185\u5bb9\u3002\u4e0d\u8fc7\uff0c\u4f60\u53ef\u80fd\u8fd8\u9700\u8981\u624b\u52a8\u6392\u9664\u5176\u4ed6\u6846\u67b6\u6216\u5185\u5bb9\u3002 <\/p>\n<p> \u8981\u624b\u52a8\u6392\u9664\u67d0\u4e00\u9879\uff0c\u8bf7\u5728 iOS \u76ee\u6807\u7684\u201cGeneral\u201d(\u901a\u7528) \u6807\u7b7e\u4e0b\u6253\u5f00\u201cFrameworks, Libraries, and Embedded Content\u201d(\u6846\u67b6\u3001\u8d44\u6e90\u5e93\u548c\u5d4c\u5165\u5f0f\u5185\u5bb9)\u3002\u7136\u540e\uff0c\u9009\u62e9 iOS \u4f5c\u4e3a\u8fd9\u4e2a\u9879\u76ee\u7684\u5e73\u53f0\u8bbe\u7f6e\u3002\u8fd9\u4e00\u8bbe\u7f6e\u4f1a\u5c06\u8fd9\u4e2a\u9879\u76ee\u4ece App \u7684 Mac \u7248\u672c\u4e2d\u6392\u9664\u3002 <\/p>\n<\/p>\n<p> \u5982\u679c\u4f60\u6709\u6e90\u4ee3\u7801\u5f15\u7528\u4e86 App \u7684 Mac \u7248\u672c\u65e0\u6cd5\u4f7f\u7528\u7684 API\uff0c\u8bf7\u5c06\u8fd9\u4e9b\u4ee3\u7801\u653e\u5230\u4f7f\u7528 <code>targetEnvironment()<\/code>: \u5e73\u53f0\u6761\u4ef6\u7684\u7f16\u8bd1\u6761\u4ef6\u5757\u4e2d\u3002 <\/p>\n<pre><code><span><span><\/span> <span><span>#if<\/span> <span>!<\/span>targetEnvironment(macCatalyst)<\/span><\/span><span><span><\/span> <span><span>\/\/ Code to exclude from Mac.<\/span><\/span><\/span><span><span><\/span> <span><span>#endif<\/span><\/span><\/span><\/code>\n<\/pre>\n<p> \u4f60\u53ef\u4ee5\u4f7f\u7528\u76f8\u540c\u7684\u65b9\u6cd5\u6765\u5305\u542b\u4ec5\u5728 macOS \u4e2d\u53ef\u7528\u7684\u6846\u67b6\u548c\u4ee3\u7801\u3002\u5bf9\u4e8e\u6846\u67b6\uff0c\u8bf7\u4e3a\u5e73\u53f0\u8bbe\u7f6e\u9009\u62e9 macOS\uff0c\u7136\u540e\u7528 <code>#if targetEnvironment(macCatalyst)<\/code> \u8bed\u53e5\u5c06\u76f8\u5e94\u7684\u4ee3\u7801\u62ec\u8d77\u6765\u3002 <\/p>\n<h3> \u8ba9\u4f60\u7684 App \u66f4\u50cf\u4e00\u6b3e Mac App <\/h3>\n<p> \u5728\u6309\u7167\u8fd9\u4e9b\u6b65\u9aa4\u64cd\u4f5c\u540e\uff0c\u4f60\u5e94\u8be5\u80fd\u591f\u5728 Mac \u4e0a\u8fd0\u884c\u4f60\u7684 iPad App \u4e86\u3002\u4e0d\u8fc7\uff0c\u5728\u5c06 App \u4ea4\u4ed8\u7ed9\u5ba2\u6237\u4e4b\u524d\uff0c\u8fd8\u9700\u8981\u8fdb\u884c\u4e00\u4e9b\u66f4\u6539\uff0c\u8ba9\u5b83\u4eff\u5982\u672c\u6765\u5c31\u662f\u4e3a Mac \u800c\u8bbe\u7684\u3002\u8981\u8fdb\u4e00\u6b65\u4e86\u89e3\uff0c\u8bf7\u53c2\u9605\u201c\u9488\u5bf9 Mac \u4f18\u5316\u4f60\u7684 iPad App\u201d\u3002 <\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u89c8 \u914d\u5408 Xcode 11 \u53ca\u66f4\u9ad8\u7248\u672c\uff0c\u4f60\u80fd\u4f7f\u7528 Mac Catalyst \u6765\u521b\u5efa iPad App \u7684 M [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":190845,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[189686],"tags":[],"class_list":["post-190844","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ios"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/190844","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=190844"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/190844\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media\/190845"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=190844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=190844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=190844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}