{"id":181690,"date":"2024-11-09T19:11:17","date_gmt":"2024-11-09T11:11:17","guid":{"rendered":"https:\/\/server.hk\/cnblog\/181690\/"},"modified":"2024-11-09T19:11:18","modified_gmt":"2024-11-09T11:11:18","slug":"%e6%b7%b1%e5%85%a5%e6%8e%a2%e7%a9%b6realm%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9a%e5%ae%83%e7%82%ba%e4%bd%95%e5%82%99%e5%8f%97%e6%ad%a1%e8%bf%8e%ef%bc%9f%ef%bc%88realm%e6%95%b8%e6%93%9a%e5%ba%ab%e6%80%8e","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/181690\/","title":{"rendered":"\u6df1\u5165\u63a2\u7a76Realm\u6578\u64da\u5eab\uff1a\u5b83\u70ba\u4f55\u5099\u53d7\u6b61\u8fce\uff1f\uff08realm\u6578\u64da\u5eab\u600e\u9ebc\u6a23\uff09"},"content":{"rendered":"<h1 id=\"%e6%b7%b1%e5%85%a5%e6%8e%a2%e7%a9%b6realm%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9a%e5%ae%83%e7%82%ba%e4%bd%95%e5%82%99%e5%8f%97%e6%ad%a1%e8%bf%8e%ef%bc%9f-ivZsWEjKhC\">\u6df1\u5165\u63a2\u7a76Realm\u6578\u64da\u5eab\uff1a\u5b83\u70ba\u4f55\u5099\u53d7\u6b61\u8fce\uff1f<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u61c9\u7528\u7a0b\u5f0f\u958b\u767c\u4e2d\uff0c\u6578\u64da\u5eab\u7684\u9078\u64c7\u5c0d\u65bc\u61c9\u7528\u7684\u6027\u80fd\u548c\u53ef\u64f4\u5c55\u6027\u81f3\u95dc\u91cd\u8981\u3002Realm\u6578\u64da\u5eab\u4f5c\u70ba\u4e00\u7a2e\u65b0\u8208\u7684\u79fb\u52d5\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\uff0c\u56e0\u5176\u9ad8\u6548\u6027\u548c\u6613\u7528\u6027\u800c\u53d7\u5230\u5ee3\u6cdb\u95dc\u6ce8\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0eRealm\u6578\u64da\u5eab\u7684\u7279\u9ede\u3001\u512a\u52e2\u4ee5\u53ca\u70ba\u4f55\u5b83\u5728\u958b\u767c\u8005\u4e2d\u5099\u53d7\u9752\u775e\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%afrealm%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9f-ivZsWEjKhC\">\u4ec0\u9ebc\u662fRealm\u6578\u64da\u5eab\uff1f<\/h2>\n<p>Realm\u662f\u4e00\u500b\u958b\u6e90\u7684\u79fb\u52d5\u6578\u64da\u5eab\uff0c\u5c08\u70ba\u79fb\u52d5\u61c9\u7528\u7a0b\u5f0f\u8a2d\u8a08\u3002\u5b83\u63d0\u4f9b\u4e86\u4e00\u500b\u7c21\u55ae\u7684API\uff0c\u5141\u8a31\u958b\u767c\u8005\u8f15\u9b06\u5730\u5728\u61c9\u7528\u4e2d\u9032\u884c\u6578\u64da\u5b58\u5132\u548c\u67e5\u8a62\u3002Realm\u7684\u8a2d\u8a08\u7406\u5ff5\u662f\u63d0\u4f9b\u4e00\u500b\u9ad8\u6548\u3001\u8f15\u91cf\u7d1a\u7684\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\uff0c\u80fd\u5920\u5728\u79fb\u52d5\u8a2d\u5099\u4e0a\u904b\u884c\uff0c\u4e26\u4e14\u652f\u6301\u591a\u5e73\u53f0\uff0c\u5305\u62eciOS\u3001Android\u548cReact Native\u3002<\/p>\n<h2 id=\"realm%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e4%b8%bb%e8%a6%81%e7%89%b9%e9%bb%9e-ivZsWEjKhC\">Realm\u6578\u64da\u5eab\u7684\u4e3b\u8981\u7279\u9ede<\/h2>\n<ul>\n<li><strong>\u9ad8\u6027\u80fd\uff1a<\/strong>Realm\u6578\u64da\u5eab\u7684\u67e5\u8a62\u901f\u5ea6\u975e\u5e38\u5feb\uff0c\u56e0\u70ba\u5b83\u4f7f\u7528\u4e86\u81ea\u5b9a\u7fa9\u7684\u4e8c\u9032\u5236\u683c\u5f0f\u4f86\u5b58\u5132\u6578\u64da\uff0c\u9019\u4f7f\u5f97\u6578\u64da\u7684\u8b80\u53d6\u548c\u5beb\u5165\u64cd\u4f5c\u90fd\u80fd\u5920\u5728\u6beb\u79d2\u7d1a\u5225\u5167\u5b8c\u6210\u3002<\/li>\n<li><strong>\u6613\u65bc\u4f7f\u7528\uff1a<\/strong>Realm\u63d0\u4f9b\u4e86\u7c21\u55ae\u76f4\u89c0\u7684API\uff0c\u958b\u767c\u8005\u53ef\u4ee5\u8f15\u9b06\u5730\u9032\u884c\u6578\u64da\u6a21\u578b\u7684\u5b9a\u7fa9\u548c\u64cd\u4f5c\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684\u793a\u4f8b\uff0c\u5c55\u793a\u5982\u4f55\u5728Realm\u4e2d\u5b9a\u7fa9\u4e00\u500b\u6578\u64da\u6a21\u578b\uff1a<\/li>\n<\/ul>\n<pre><code>class Dog: Object {\n    @objc dynamic var name = \"\"\n    @objc dynamic var age = 0\n}<\/code><\/pre>\n<ul>\n<li><strong>\u5be6\u6642\u6578\u64da\u540c\u6b65\uff1a<\/strong>Realm\u652f\u6301\u5be6\u6642\u6578\u64da\u540c\u6b65\uff0c\u9019\u610f\u5473\u8457\u7576\u6578\u64da\u767c\u751f\u8b8a\u5316\u6642\uff0c\u6240\u6709\u9023\u63a5\u7684\u5ba2\u6236\u7aef\u90fd\u80fd\u5920\u5373\u6642\u7372\u53d6\u66f4\u65b0\uff0c\u9019\u5c0d\u65bc\u9700\u8981\u5373\u6642\u53cd\u994b\u7684\u61c9\u7528\u7a0b\u5f0f\u5c24\u70ba\u91cd\u8981\u3002<\/li>\n<li><strong>\u8de8\u5e73\u53f0\u652f\u6301\uff1a<\/strong>Realm\u4e0d\u50c5\u652f\u6301iOS\u548cAndroid\uff0c\u9084\u652f\u6301\u591a\u7a2e\u7de8\u7a0b\u8a9e\u8a00\u548c\u6846\u67b6\uff0c\u9019\u4f7f\u5f97\u958b\u767c\u8005\u53ef\u4ee5\u5728\u4e0d\u540c\u7684\u5e73\u53f0\u4e0a\u4f7f\u7528\u76f8\u540c\u7684\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\u3002<\/li>\n<\/ul>\n<h2 id=\"realm%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e5%84%aa%e5%8b%a2-ivZsWEjKhC\">Realm\u6578\u64da\u5eab\u7684\u512a\u52e2<\/h2>\n<p>Realm\u6578\u64da\u5eab\u7684\u53d7\u6b61\u8fce\u7a0b\u5ea6\u4e0d\u50c5\u50c5\u4f86\u81ea\u65bc\u5176\u6027\u80fd\u548c\u6613\u7528\u6027\uff0c\u9084\u6709\u5176\u4ed6\u5e7e\u500b\u95dc\u9375\u512a\u52e2\uff1a<\/p>\n<ul>\n<li><strong>\u7121\u9700SQL\u77e5\u8b58\uff1a<\/strong>\u8207\u50b3\u7d71\u7684\u95dc\u4fc2\u578b\u6578\u64da\u5eab\u4e0d\u540c\uff0cRealm\u4e0d\u9700\u8981\u958b\u767c\u8005\u5177\u5099SQL\u77e5\u8b58\uff0c\u9019\u964d\u4f4e\u4e86\u5b78\u7fd2\u66f2\u7dda\uff0c\u4f7f\u5f97\u65b0\u624b\u958b\u767c\u8005\u4e5f\u80fd\u5feb\u901f\u4e0a\u624b\u3002<\/li>\n<li><strong>\u8f15\u91cf\u7d1a\uff1a<\/strong>Realm\u7684\u5eab\u5927\u5c0f\u76f8\u5c0d\u8f03\u5c0f\uff0c\u9019\u5c0d\u65bc\u79fb\u52d5\u61c9\u7528\u4f86\u8aaa\u662f\u975e\u5e38\u91cd\u8981\u7684\uff0c\u56e0\u70ba\u5b83\u80fd\u5920\u6e1b\u5c11\u61c9\u7528\u7684\u6574\u9ad4\u5927\u5c0f\uff0c\u63d0\u9ad8\u4e0b\u8f09\u901f\u5ea6\u3002<\/li>\n<li><strong>\u826f\u597d\u7684\u793e\u5340\u652f\u6301\uff1a<\/strong>\u4f5c\u70ba\u4e00\u500b\u958b\u6e90\u9805\u76ee\uff0cRealm\u64c1\u6709\u6d3b\u8e8d\u7684\u958b\u767c\u8005\u793e\u5340\uff0c\u9019\u610f\u5473\u8457\u958b\u767c\u8005\u53ef\u4ee5\u8f15\u9b06\u627e\u5230\u8cc7\u6e90\u548c\u652f\u6301\u3002<\/li>\n<\/ul>\n<h2 id=\"%e4%bd%bf%e7%94%a8realm%e7%9a%84%e5%a0%b4%e6%99%af-ivZsWEjKhC\">\u4f7f\u7528Realm\u7684\u5834\u666f<\/h2>\n<p>Realm\u6578\u64da\u5eab\u7279\u5225\u9069\u5408\u4ee5\u4e0b\u5e7e\u7a2e\u5834\u666f\uff1a<\/p>\n<ul>\n<li>\u9700\u8981\u9ad8\u6027\u80fd\u6578\u64da\u5b58\u5132\u7684\u79fb\u52d5\u61c9\u7528\uff0c\u4f8b\u5982\u793e\u4ea4\u5a92\u9ad4\u61c9\u7528\u548c\u904a\u6232\u3002<\/li>\n<li>\u9700\u8981\u5be6\u6642\u6578\u64da\u540c\u6b65\u7684\u61c9\u7528\uff0c\u4f8b\u5982\u5373\u6642\u901a\u8a0a\u5de5\u5177\u3002<\/li>\n<li>\u9700\u8981\u8de8\u5e73\u53f0\u652f\u6301\u7684\u61c9\u7528\uff0c\u4f8b\u5982\u4f7f\u7528React Native\u958b\u767c\u7684\u61c9\u7528\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b5%90%e8%ab%96-ivZsWEjKhC\">\u7d50\u8ad6<\/h2>\n<p>Realm\u6578\u64da\u5eab\u56e0\u5176\u9ad8\u6027\u80fd\u3001\u6613\u7528\u6027\u548c\u5be6\u6642\u6578\u64da\u540c\u6b65\u529f\u80fd\u800c\u53d7\u5230\u958b\u767c\u8005\u7684\u9752\u775e\u3002\u7121\u8ad6\u662f\u65b0\u624b\u9084\u662f\u7d93\u9a57\u8c50\u5bcc\u7684\u958b\u767c\u8005\uff0c\u90fd\u80fd\u5920\u5f9e\u4e2d\u53d7\u76ca\u3002\u96a8\u8457\u79fb\u52d5\u61c9\u7528\u9700\u6c42\u7684\u589e\u9577\uff0cRealm\u7121\u7591\u5c07\u5728\u672a\u4f86\u7684\u958b\u767c\u4e2d\u626e\u6f14\u91cd\u8981\u89d2\u8272\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u53ef\u9760\u7684\u6578\u64da\u5b58\u5132\u89e3\u6c7a\u65b9\u6848\uff0c\u4e26\u5e0c\u671b\u642d\u914d\u9ad8\u6548\u7684\u4f3a\u670d\u5668\u8cc7\u6e90\uff0c\u8003\u616e\u4f7f\u7528<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u4f86\u652f\u6301\u60a8\u7684\u61c9\u7528\u958b\u767c\u9700\u6c42\u3002\u7121\u8ad6\u662f\u6578\u64da\u5eab\u9084\u662f\u4f3a\u670d\u5668\uff0c\u9078\u64c7\u5408\u9069\u7684\u5de5\u5177\u5c07\u6709\u52a9\u65bc\u63d0\u5347\u60a8\u7684\u958b\u767c\u6548\u7387\u548c\u61c9\u7528\u6027\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6df1\u5165\u63a2\u7a76Realm\u6578\u64da\u5eab\u7684\u512a\u52e2\u8207\u7279\u9ede\uff0c\u4e86\u89e3\u5176\u70ba\u4f55\u5728\u79fb\u52d5\u61c9\u7528\u958b\u767c\u4e2d\u5099\u53d7\u6b61\u8fce\uff0c\u63d0\u5347\u6578\u64da\u7ba1\u7406\u6548\u7387\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-181690","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/181690","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=181690"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/181690\/revisions"}],"predecessor-version":[{"id":181691,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/181690\/revisions\/181691"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=181690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=181690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=181690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}