\u82f9\u679c\u63cf\u8ff0\u6587\u4ef6webclip\u600e\u4e48\u5220\u9664<\/a>iewController, WKNavigationDelegate {<\/p>\n“`<\/p>\n
3. \u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\u6765\u52a0\u8f7d\u60a8\u8981\u5c01\u88c5\u7684\u7f51\u9875\uff1a<\/p>\n
“`swift<\/p>\n
override func viewDidLoad() {<\/p>\n
super.viewDidLoad()<\/p>\n
let webView = WKWebView(frame: CGRect.zero)<\/p>\n
webView.navigationDelegate = self<\/p>\n
view.addSubview(webView)<\/p>\n
webView.translatesAutoresizingMaskIntoConstraints = false<\/p>\n
let topConstraint = webView.topAnchor.constraint(equalTo: view.topAnchor)<\/p>\n
let bottomConstraint = webView.bottomAnchor.constraint(equalTo: view.bottomAnchor)<\/p>\n
let leftConstraint = webView.leftAnchor.constraint(equalTo: view.leftAnchor)<\/p>\n
let rightConstraint = webView.rightAnchor.constraint(equalTo: view.rightAnchor)<\/p>\n
NSLayoutConstraint.activate([topConstraint, bottomConstraint, leftConstraint, rightConstraint])<\/p>\n
if let url = URL(string: “https:\/\/yourwebsite.com”) {<\/p>\n
let request = URLRequest(url: url)<\/p>\n
webView.load(request)<\/p>\n
}<\/p>\n
}<\/p>\n
“`<\/p>\n
\u786e\u4fdd\u66ff\u6362\u6389 “https:\/\/yourwebsite.com” \u4e3a\u60a8\u5b9e\u9645\u8981\u5c01\u88c5\u7684\u7f51\u9875\u5730\u5740\u3002<\/p>\n
\u6b65\u9aa4\u56db\uff1a\u7f16\u8bd1\u5e76\u8fd0\u884c App<\/p>\n
1. \u8fde\u63a5 iOS \u8bbe\u5907\u5e76\u9009\u62e9\u4f5c\u4e3a\u8fd0\u884c\u76ee\u6807\u8bbe\u5907\u3002<\/p>\n
2. \u5728 Xcode \u4e2d\uff0c\u70b9\u51fb “Run” \u6309\u94ae\uff0c\u5373\u53ef\u770b\u5230\u60a8\u7684\u7f51\u9875\u5728 iOS \u8bbe\u5907\u4e0a\u6253\u5f00\u3002<\/p>\n
\u6ce8\u610f\uff1a\u60a8\u9700\u8981\u4fee\u6539\u9879\u76ee\u8bbe\u7f6e\u4ee5\u652f\u6301\u514d\u7b7e\u540d\u5b89\u88c5\u3002\u5728 “Target” \u8bbe\u7f6e\u4e2d\uff0c\u627e\u5230 “Signing & Capabilities”\uff0c\u5e76\u5411\u5176\u4e2d\u6dfb\u52a0\u60a8\u7684\u4f01\u4e1a\u8bc1\u4e66\u3002<\/p>\n
\u73b0\u5728\u60a8\u5df2\u7ecf\u6210\u529f\u5730\u5c06\u7f51\u9875\u5c01\u88c5\u6210\u514d\u7b7e\u540d\u7684 iOS App\uff0c\u53ef\u4ee5\u5c06\u5176\u5206\u4eab\u7ed9\u60a8\u7684\u7528\u6237\u5e76\u5728 iOS \u8bbe\u5907\u4e0a\u5b89\u88c5\u4f7f\u7528\u3002\u5f53\u7136\uff0c\u514d\u7b7e\u540d\u5b89\u88c5\u7684 App \u5b58\u5728\u4e00\u5b9a\u7684\u98ce\u9669\uff0c\u56e0\u4e3a\u5b83\u7ed5\u8fc7\u4e86 App Store \u7684\u5ba1\u6838\u673a\u5236\u3002\u5728\u8fd9\u91cc\u63a8\u8350\u60a8\u8c28\u614e\u4f7f\u7528\u514d\u7b7e\u540d\u5b89\u88c5\uff0c\u5e76\u786e\u4fdd\u9075\u5faa Apple \u7684\u76f8\u5173\u89c4\u5b9a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u6807\u9898\uff1a\u5c06\u7f51\u9875\u5c01\u88c5\u6210\u514d\u7b7e\u540d\u7684 iOS App\uff08\u539f\u7406\u4e0e\u8be6\u7ec6\u6559\u7a0b\uff09\u968f\u7740\u79fb\u52a8\u4e92\u8054\u7f51\u7684\u666e\u53ca\uff0c\u8d8a\u6765\u8d8a\u591a\u7684\u4eba\u60f3\u5c06\u81ea\u5df1\u7684\u7f51\u7ad9\u6216\u7f51\u9875\u5185\u5bb9\u5c01\u88c5\u6210\u4e00\u4e2a iOS App\uff0c\u65b9\u4fbf\u7528\u6237\u8bbf\u95ee\u548c\u4f7f\u7528\u3002\u514d\u7b7e\u540d\u5b89\u88c5\u5219\u964d\u4f4e\u4e86\u5f00\u53d1\u8005\u7684\u6210\u672c\uff0c<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[3346,241,414,16186,588],"topic":[],"class_list":["post-10039","post","type-post","status-publish","format-standard","hentry","category-iosmainqian","tag-webclip","tag-241","tag-414","tag-16186","tag-588"],"_links":{"self":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/10039","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/comments?post=10039"}],"version-history":[{"count":1,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/10039\/revisions"}],"predecessor-version":[{"id":10205,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/10039\/revisions\/10205"}],"wp:attachment":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/media?parent=10039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/categories?post=10039"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/tags?post=10039"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/topic?post=10039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}