{"id":5814,"date":"2022-05-11T14:10:57","date_gmt":"2022-05-11T06:10:57","guid":{"rendered":"http:\/\/123.57.164.21\/?p=5814"},"modified":"2022-05-11T14:10:57","modified_gmt":"2022-05-11T06:10:57","slug":"ios%e4%bc%a0%e6%84%9f%e5%99%a8%ef%bc%9a%e5%88%a9%e7%94%a8%e7%a3%81%e5%8a%9b%e8%ae%a1%e5%ae%8c%e6%88%90%e4%b8%80%e4%b8%aaar%e5%9c%ba%e6%99%af%e5%ba%94%e7%94%a8","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=5814","title":{"rendered":"iOS\u4f20\u611f\u5668\uff1a\u5229\u7528\u78c1\u529b\u8ba1\u5b8c\u6210\u4e00\u4e2aAR\u573a\u666f\u5e94\u7528"},"content":{"rendered":"\n<p>\u4eca\u5929\u54b1\u4eec\u5c31\u7528\u7528\u7b2c\u4e09\u4e2a\u4f20\u611f\u5668&#8211;\u78c1\u529b\u8ba1&#8211;\u6765\u505a\u4e00\u4e2aAR\u7684\u573a\u666f\u3002\u8bf4\u5230AR\u8fd9\u4e2a\u8bcd\uff0c\u8bf7\u5927\u5bb6\u4e0d\u8981\u55b7\u6211\u54c8\uff0c\u5e76\u6ca1\u6709\u7528\u5230WWDC\u521a\u51fa\u7684ARKit\u3002\u800c\u4e14\u4eca\u5929\u8fd9\u4e2a\u4f8b\u5b50\u91cd\u70b9\u662f\u5b66\u4e60\u4f7f\u7528\u78c1\u529b\u8ba1\uff0c\u672c\u8d28\u4e0a\u6765\u8bb2\u548cAR\u5173\u7cfb\u5e76\u4e0d\u5927\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-48.png\" alt=\"\" class=\"wp-image-5815\" width=\"426\" height=\"284\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-48.png 878w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-48-300x201.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-48-768x514.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-48-830x556.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-48-230x154.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-48-350x234.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-48-480x321.png 480w\" sizes=\"(max-width: 426px) 100vw, 426px\" \/><\/figure><\/div>\n\n\n\n<p>\u78c1\u529b\u8ba1\u8ddf\u524d\u9762\u7684\u52a0\u901f\u8ba1\u3001\u9640\u87ba\u4eea\uff0c\u90fd\u662f\u7528\u5230\u4e86\u4e0a\u6b21\u8bf4\u7684iOS\u5f53\u4e2d\u7684\u90a3\u4e2a\u6838\u5fc3\u8fd0\u52a8\u6846\u67b6<code>CoreMotion<\/code>, \u4e5f\u90fd\u7528\u4e86<code>CMMotionManager<\/code>\u3002<\/p>\n\n\n\n<p>\u5b8c\u6210\u540e\u7684\u6548\u679c\uff0c\u80fd\u770b\u5230\u5728\u89c6\u9891\u8f93\u51fa\u7684\u4e0b\u9762\u4f1a\u6709\u4e00\u4e2a\u968f\u7740\u5c4f\u5e55\u79fb\u52a8\u7684\u5929\u7a7a\u661f\u8fb0\u80cc\u666f\u56fe\uff0c\u540c\u65f6\u5c4f\u5e55\u5de6\u4e0a\u89d2\u4f1a\u5b9e\u65f6\u6253\u5370\u5f53\u524d\u7684\u65b9\u5411\u4fe1\u606f\u3001\u5730\u7406\u4fe1\u606f\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/05\/2248583-f9b8716ff271e94d.webp\" alt=\"\" class=\"wp-image-5816\" width=\"301\" height=\"496\"\/><\/figure><\/div>\n\n\n\n<p><strong>1. \u78c1\u529b\u8ba1\u7684\u4ecb\u7ecd<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u78c1\u5f3a\u8ba1\u6307\u7684\u662f\u5404\u79cd\u7528\u4e8e\u6d4b\u91cf\u78c1\u573a\u7684\u4eea\u5668\uff0c\u4e5f\u79f0\u78c1\u529b\u4eea\u3001\u9ad8\u65af\u8ba1\u3002\u5b83\u53ef\u4ee5\u611f\u5e94\u5730\u7403\u7684\u78c1\u573a\uff0c\u83b7\u5f97\u65b9\u5411\u4fe1\u606f\u3002<\/p>\n\n\n\n<p><strong>1.1 \u5e94\u7528\u573a\u666f<\/strong><\/p>\n\n\n\n<p>\u90a3\u663e\u800c\u6613\u89c1\uff0c\u5178\u578b\u7684\u5e94\u7528\u573a\u666f\u5c31\u662f\u7528\u5728\u7535\u5b50\u7f57\u76d8\u548c\u5bfc\u822a\u4e0a\u9762\u3002<\/p>\n\n\n\n<p>\u4e4b\u524d\u770b\u5230\u8fc7\u67d0\u4e2a\u5927\u795e\u7528\u78c1\u529b\u8ba1\u7b80\u76f4\u73a9\u51fa\u4e86\u82b1\u513f\uff0c\u9694\u7a7a\u6293\u725b\u7684\u611f\u89c9\u3002\u5229\u7528iPhone\u4e0a\u78c1\u529b\u8ba1\u3001\u52a0\u901f\u8ba1\u548c\u9ea6\u514b\u98ce\u5b9e\u73b0\u5e73\u9762\u548c\u4e09\u7ef4\u4e0a\u7684\u78c1\u94c1\u8ffd\u8e2a\uff0c\u5e76\u80fd\u5b9e\u65f6\u7684\u53cd\u9988\u5728iPhone \u5c4f\u5e55\u4e0a\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-49.png\" alt=\"\" class=\"wp-image-5817\" width=\"614\" height=\"341\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-49.png 884w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-49-300x167.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-49-768x427.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-49-830x462.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-49-230x128.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-49-350x195.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-49-480x267.png 480w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/figure><\/div>\n\n\n\n<p><strong>1.2 \u9700\u8981\u4e86\u89e3\u7684\u57fa\u672c\u6982\u5ff5<\/strong><\/p>\n\n\n\n<p>\u8981\u7528\u5230\u78c1\u529b\u8ba1\uff0c\u7ecf\u5e38\u4f1a\u542c\u5230\u6709\u4eba\u8bf4\u5230\u201c\u78c1\u5317\u201d\u3001\u201c\u771f\u5317\u201d\u8fd9\u4e24\u4e2a\u9ad8\u9891\u8bcd\uff0cCoreMotion\u4e5f\u4f1a\u7ed9\u6211\u4eec\u8fd4\u56de\u8fd9\u4e24\u4e2a\u6570\u503c\u3002\u662f\u4ec0\u4e48\u610f\u601d\u5450\uff1f<\/p>\n\n\n\n<ul><li>\u771f\u5317\uff1a\u6307\u7684\u662f\u5730\u7406\u7684\u5317\u6781<\/li><li>\u78c1\u5317\uff1a\u6307\u7684\u662f\u78c1\u573a\u5317\u6781<\/li><\/ul>\n\n\n\n<p>\u7eb3\u5c3c\uff1f\u8fd9\u662f\u4ec0\u4e48\u9b3c\uff1f\u6765\u6765\u6765\uff0c\u54b1\u4eec\u79d1\u666e\u4e00\u4e0b\u3002<\/p>\n\n\n\n<ol><li>\u78c1\u5317<br>\u78c1\u5317\u662f\u4ee5\u5927\u5730\u78c1\u573a\u4e3a\u57fa\u51c6\u7684\uff0c\u901a\u8fc7\u5404\u79cd\u4f20\u611f\u5668\u4f20\u9001\u7684\u65b9\u4f4d\u90fd\u662f\u4ee5\u78c1\u5317\u4e3a\u57fa\u51c6\u7684\u3002BUT\uff01\uff01\uff01\uff01\u6572\u9ed1\u677f\uff01\uff01\uff01\uff01\uff01\u78c1\u5317\u7684\u5177\u4f53\u4f4d\u7f6e\u662f\u968f\u7740\u65f6\u95f4\u800c\u6539\u53d8\u7684\u3002<br>\u4e5f\u5c31\u662f\u8bf4\u54b1\u4eec\u968f\u7740\u5730\u7403\u7684\u65cb\u8f6c\uff0c\u54b1\u4eec\u9664\u4e86\u6709\u4e00\u5e74\u56db\u5b63\u7684\u53d8\u5316\u3001\u65f6\u95f4\u7684\u53d8\u5316\uff0c\u8fde\u78c1\u573a\u90fd\u4f1a\u53d1\u751f\u6539\u53d8\u3002\u55ef\uff0c\u662f\u8fd9\u6837\u7684\u3002<\/li><li>\u771f\u5317<br>\u7531\u4e8e\u78c1\u5317\u662f\u4f1a\u53d8\u5316\u7684\uff0c\u90a3\u6211\u4eec\u600e\u4e48\u7528\uff1f\u4e0d\u53ef\u80fd\u8fd8\u8981\u8ba1\u7b97\u5730\u7403\u81ea\u8f6c\u8f74\u3001\u8003\u8651\u65f6\u95f4\u56e0\u7d20\u5427\u3002\u6240\u4ee5\u624d\u6709\u4e86\u771f\u5317\u8fd9\u4e2a\u6982\u5ff5\u3002<\/li><\/ol>\n\n\n\n<p>\u771f\u5317\u662f\u5730\u7403\u81ea\u8f6c\u7684\u5730\u7406\u5317\u6781\uff0c\u8fd9\u4e2a\u5c31\u662f\u8003\u8651\u5230\u4e86\u5404\u79cd\u56e0\u7d20\uff0c\u662f\u4e00\u4e2a\u56fa\u5b9a\u7684\u4f4d\u7f6e\u3002\u6240\u4ee5\u54b1\u4eec\u7535\u5b50\u7f57\u76d8\u795e\u9a6c\u7684\u6240\u6307\u7684\u5317\uff0c\u8bf4\u7684\u662f\u8fd9\u4e2a\u771f\u5317\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u65b9\u4f4d\u90fd\u662f\u9700\u8981\u77eb\u6b63\u5230\u771f\u5317\u7684\u3002\u82f9\u679c\u5f88\u8d34\u5fc3\u554a\uff0c\u771f\u5317\u5c31\u4e0d\u7528\u81ea\u5df1\u7b97\u4e86\uff0c\u76f4\u63a5\u4e5f\u4f1a\u6709\u8fd4\u56de\u7684\u6570\u503c\u3002<\/p>\n\n\n\n<p>\u5269\u4e0b\u7684\u8fd8\u6709\u78c1\u504f\u89d2\u6821\u6b63\u3001\u7f51\u7edc\u5317\u3001\u7f51\u7edc\u5317\u6821\u6b63\u3001\u6536\u655b\u89d2\u7b49\u7b49\u5b66\u672f\u6982\u5ff5\u3002<\/p>\n\n\n\n<p>\u90a3\u5c82\u4e0d\u662f\u7535\u5b50\u7f57\u76d8\u4e0a\u9762\u7684\u5317\u548c\u6307\u5357\u9488\u4e0a\u9762\u7684\u5317\u4e0d\u4e00\u81f4\u554a\uff1f<\/p>\n\n\n\n<p>\u95ee\u8fd9\u4e2a\u95ee\u9898\u7684\u7ae5\u978b\u90a3\u662f\u76f8\u5f53\u7684\u806a\u660e\u5440\uff0c\u90a3\u80af\u5b9a\u662f\u4e0d\u4e00\u81f4\u7684\u3002\u4e0d\u8fc7\u8bef\u5dee\u4e5f\u662f\u5728\u53ef\u611f\u5b98\u63a5\u53d7\u7684\u8303\u56f4\u5185\u3002\u5728\u7b49\u4f1a\u513f\u7684\u4f8b\u5b50\u91cc\u9762\uff0c\u54b1\u4eec\u628a\u8fd9\u4e24\u4e2a\u6570\u503c\u90fd\u6253\u5370\u51fa\u6765\uff0c\u81ea\u5df1\u770b\u770b\u3002<\/p>\n\n\n\n<p><strong>2. \u78c1\u529b\u8ba1\u7684\u4f7f\u7528<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>2.1 \u4f7f\u7528\u6b65\u9aa4<\/strong><\/p>\n\n\n\n<p>\u78c1\u529b\u8ba1\u540c\u6837\u4e5f\u662f\u901a\u8fc7CoreMotion<br>\u8fd9\u4e2a\u6846\u67b6\u6765\u7ba1\u7406\u7684\uff0c\u6240\u4ee5\u548c\u524d\u9762\u4e24\u4e2a\u4f20\u611f\u5668\u4e00\u6837\uff0c\u56db\u4e2a\u6807\u51c6\u6b65\u9aa4\uff1a<\/p>\n\n\n\n<ul><li>\u521d\u59cb\u5316CMMotionManager\u7ba1\u7406\u5bf9\u8c61\uff1b<\/li><li>\u8c03\u7528\u7ba1\u7406\u5bf9\u8c61\u7684\u5bf9\u8c61\u65b9\u6cd5\u83b7\u53d6\u6570\u636e\uff1b<\/li><li>\u5904\u7406\u6570\u636e\uff1b<\/li><li>\u5f53\u4e0d\u9700\u8981\u4f7f\u7528\u7684\u65f6\u5019\uff0c\u505c\u6b62\u83b7\u53d6\u6570\u636e\u3002<\/li><\/ul>\n\n\n\n<p><strong>2.2 \u78c1\u529b\u8ba1\u6570\u636e\u83b7\u53d6\u7684\u4e24\u79cd\u65b9\u6cd5<\/strong><\/p>\n\n\n\n<p><code>CoreMotion<\/code>\u4e2d\u67092\u79cd\u83b7\u53d6\u6570\u636e\u65b9\u5f0f\uff0c\u4e00\u79cd\u53eb\u505aPUSH\u7684\u65b9\u5f0f\uff0c\u4e00\u79cd\u53eb\u505aPULL\u7684\u65b9\u5f0f\u3002\u987e\u540d\u601d\u4e49\uff0cPUSH\u5c31\u662f\u88ab\u52a8\u7684\u83b7\u53d6\u3002\u8bbe\u5b9a\u5b8c\u4e86\u4e4b\u540e\uff0c\u7ebf\u7a0b\u5b9a\u65f6\u628a\u83b7\u53d6\u5230\u7684\u6570\u636e\u63a8\u9001\u56de\u6765\u3002\u53ef\u60f3\u800c\u77e5\uff0c\u5bf9\u4e8e\u8d44\u6e90\u7684\u6d88\u8017\u662f\u4f1a\u7a0d\u5fae\u5927\u4e00\u70b9\u7684\u3002PULL\uff0c\u5c31\u662f\u8981\u53bb\u7d22\u53d6\u3002\u62c9\u4e00\u4e0b\u624d\u4f1a\u83b7\u53d6\u5230\u6570\u636e\u3002\u4e0d\u8981\u4e0d\u7ed9\u3002\u4e0a\u4e00\u6b21\u4ee3\u7801\u662fSwift\u7684\uff0c\u8fd9\u4e00\u6b21\u54b1\u4eec\u5c31\u4f7f\u7528OC\u5566\u3002<\/p>\n\n\n\n<p><strong>2.2.1 PULL\u7684\u65b9\u5f0f<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/PULL\u7684\u65b9\u6cd5\u83b7\u53d6\u6570\u636e\n- (void)pullMagnetometer {\n    \/\/    \u5224\u65ad\u78c1\u529b\u8ba1\u662f\u5426\u53ef\u7528\n    if (self.manager.magnetometerAvailable) {\n        \/\/        \u8bbe\u7f6e\u78c1\u529b\u8ba1\u91c7\u6837\u9891\u7387\n        self.manager.magnetometerUpdateInterval = 0.1;\n        \n        \/\/\u5f00\u59cb\u66f4\u65b0\uff0c\u540e\u53f0\u7ebf\u7a0b\u5f00\u59cb\u8fd0\u884c\u3002\u8fd9\u662fPull\u65b9\u5f0f\u3002\n        [self.manager startMagnetometerUpdates];\n        NSLog(@\"X = %f,Y = %f,Z = %f\",self.manager.magnetometerData.magneticField.x,self.manager.magnetometerData.magneticField.y,self.manager.magnetometerData.magneticField.z);\n        \n    } else {\n        NSLog(@\"It cannot be used!\");\n    }\n}<\/pre>\n\n\n\n<p><strong>2.2.2 PUSH\u7684\u65b9\u5f0f<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/PUSH\u7684\u65b9\u6cd5\u83b7\u53d6\u6570\u636e\n- (void)pushMagnetometer {\n    \/\/    \u5224\u65ad\u78c1\u529b\u8ba1\u662f\u5426\u53ef\u7528\n    if (self.manager.magnetometerAvailable) {\n        \/\/        \u8bbe\u7f6e\u78c1\u529b\u8ba1\u91c7\u6837\u9891\u7387\n        self.manager.magnetometerUpdateInterval = 0.1;\n        \n        \/\/Push\u65b9\u5f0f\u83b7\u53d6\u548c\u5904\u7406\u6570\u636e\uff0c\u8fd9\u91cc\u6211\u4eec\u4e00\u6837\u53ea\u662f\u505a\u4e86\u7b80\u5355\u7684\u6253\u5370\u3002\u628a\u91c7\u6837\u7684\u5de5\u4f5c\u653e\u5728\u4e86\u4e3b\u7ebf\u7a0b\u4e2d\u3002\n        [self.manager startMagnetometerUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMMagnetometerData * _Nullable magnetometerData, NSError * _Nullable error) {\n            NSLog(@\"X = %f,Y = %f,Z = %f\",magnetometerData.magneticField.x,magnetometerData.magneticField.y,magnetometerData.magneticField.z);\n        }];\n    } else {\n        NSLog(@\"It cannot be used!\");\n    }\n}<\/pre>\n\n\n\n<p><strong>3. \u5f00\u59cb\u6211\u4eec\u7684\u5c0f\u6848\u4f8b<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5199\u8fd9\u4e2a\u6848\u4f8b\u7684\u65f6\u5019\u53d1\u73b0\u8981\u5b9e\u73b0\u4e00\u4e2a\u6bd4\u8f83\u903c\u771f\u7684AR\uff0c\u54b1\u4eec\u6709\u597d\u591a\u4e1c\u4e1c\u90fd\u6ca1\u6709\u5206\u4eab\u8fc7\u3002\u6240\u4ee5\u4f8b\u5b50\u5199\u5b8c\u4e4b\u540e\uff0c\u5199\u8fd9\u7bc7\u6587\u7ae0\u7684\u65f6\u5019\u53c8\u5bf9\u8fd9\u4e2a\u4f8b\u5b50\u505a\u4e86\u4e00\u4e9b\u8c03\u6574\u3002\u5927\u5e45\u7b80\u5316\u5220\u51cf\u4e86\u4e86\u597d\u591a\u9700\u6c42\u3002\u4f46\u662f\uff0c\u6700\u540e\u8fd8\u662f\u4f7f\u7528\u4e86\u76f8\u673a\u3001\u767e\u5ea6\u5730\u56fe\uff0c\u5982\u679c\u8fd9\u4e24\u4e2a\u90fd\u4e0d\u7528\uff0c\u90a3\u771f\u7684\u4e00\u70b9\u90fd\u4e0d\u80fd\u7b97\u662fAR\u4e86\u3002<\/p>\n\n\n\n<p>\u5b8c\u6210\u540e\u7684\u6548\u679c\uff0c\u80fd\u770b\u5230\u5728\u89c6\u9891\u8f93\u51fa\u7684\u4e0b\u9762\u4f1a\u6709\u4e00\u4e2a\u968f\u7740\u5c4f\u5e55\u79fb\u52a8\u7684\u5929\u7a7a\u661f\u8fb0\u80cc\u666f\u56fe\uff0c\u540c\u65f6\u5c4f\u5e55\u5de6\u4e0a\u89d2\u4f1a\u5b9e\u65f6\u6253\u5370\u5f53\u524d\u7684\u65b9\u5411\u4fe1\u606f\u3001\u5730\u7406\u4fe1\u606f\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/05\/2248583-f9b8716ff271e94d-1.webp\" alt=\"\" class=\"wp-image-5818\" width=\"269\" height=\"444\"\/><\/figure><\/div>\n\n\n\n<p>\u5c0f\u6848\u4f8b\u91cc\u9762\u7684\u76f8\u673a\u4e0d\u7528\u7d27\u5f20\uff0c\u54b1\u4eec\u540e\u9762\u4e5f\u8fd8\u662f\u4f1a\u5206\u4eab\u7684\u3002\u8fd8\u6709\u4e00\u4e2a\u4e4b\u524d\u8bf4\u8fc7\u7684\uff0c\u591a\u7ebf\u7a0b\u4e5f\u8bb0\u5f97\u7684\u54c8\uff0c\u4e0b\u4e00\u4e2a\u7cfb\u5217\u5c31\u6765\u8865\u3002<\/p>\n\n\n\n<p><strong>3.1 \u601d\u7ef4\u5bfc\u56fe<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-50-1024x814.png\" alt=\"\" class=\"wp-image-5819\" width=\"466\" height=\"370\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-50-1024x814.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-50-300x238.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-50-768x610.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-50-830x660.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-50-230x183.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-50-350x278.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-50-480x381.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-50.png 1052w\" sizes=\"(max-width: 466px) 100vw, 466px\" \/><\/figure><\/div>\n\n\n\n<p><strong>3.2 \u51c6\u5907\u5de5\u4f5c<\/strong><\/p>\n\n\n\n<p>3.2.1 SDK\u7684\u5bfc\u5165<\/p>\n\n\n\n<p>\u8fd9\u4e2a\u4f8b\u5b50\u91cc\u9762\u54b1\u4eec\u7528\u4e86\u767e\u5ea6\u5730\u56fe\uff0c\u6240\u4ee5\u9700\u8981\u5bfc\u5165\u767e\u5ea6\u5730\u56fe\u7684SDK\u3002\u56e0\u4e3a\u54b1\u4eec\u6ca1\u6709\u5206\u4eab\u8fc7\u5982\u4f55\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\uff0c\u53ef\u4ee5\u770b\u770b\u8fd9\u7bc7\u6587\u7ae0<a rel=\"noreferrer noopener\" href=\"https:\/\/www.jianshu.com\/p\/7bfa5cdd4d36\" target=\"_blank\">iOS\u00b7\u91c7\u7528\u7b2c\u4e09\u65b9(\u767e\u5ea6\u5730\u56feSDK)\u5b9e\u73b0\u5b9a\u4f4d\u7b49\u529f\u80fd\u5f00\u53d1<\/a><\/p>\n\n\n\n<p>3.2.2 \u76f8\u673a\u3001\u5b9a\u4f4d\u6743\u9650\u7684\u7d22\u53d6<\/p>\n\n\n\n<p>Phone\u5bf9\u4e8eAPP\u4f7f\u7528\u7528\u6237\u7684\u9690\u79c1\u6743\u9650\u505a\u4e86\u5f88\u4e25\u683c\u7684\u89c4\u5b9a\uff0c\u6bcf\u4e2aAPP\u4f7f\u7528\u7528\u6237\u9690\u79c1\u4e4b\u524d\u5fc5\u987b\u8981\u8ba9\u7528\u6237\u77e5\u9053\u5e76\u4e14\u540c\u610f\u3002\u5927\u6982\u4e5f\u6b63\u662f\u56e0\u4e3a\u8fd9\u70b9\uff0c\u672c\u5b85\u80d6\u624d\u8fd9\u4e48\u7231iPhone\u5427\u3002\u867d\u7136\u5f00\u53d1\u7684\u65f6\u5019\u5c31\u9762\u4e34\u7740\u5f88\u591a\u95ee\u9898\uff0c\u4f46\u81f3\u5c11\u4ea7\u54c1\u59cb\u7ec8\u662f\u7ad9\u5728\u7528\u6237\u7684\u89d2\u5ea6\u8003\u8651\u95ee\u9898\u7684\u3002<\/p>\n\n\n\n<p>\u5728Info.plist\u4e2d\u5411\u7528\u6237\u7d22\u53d6\u76f8\u673a\u548c\u5730\u7406\u4f4d\u7f6e\u4fe1\u606f\u7684\u6743\u9650\u3002<\/p>\n\n\n\n<ul><li>Privacy &#8211; Camera Usage Description<\/li><li>Privacy &#8211; Location When In Use Usage Description<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-51-1024x592.png\" alt=\"\" class=\"wp-image-5820\" width=\"585\" height=\"337\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-51-1024x592.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-51-300x174.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-51-768x444.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-51-830x480.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-51-230x133.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-51-350x202.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-51-480x278.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/05\/\u56fe\u7247-51.png 1072w\" sizes=\"(max-width: 585px) 100vw, 585px\" \/><\/figure><\/div>\n\n\n\n<p>\u9ea6\u514b\u98ce\u3001\u5a92\u4f53\u5e93\u7684\u6743\u9650\u5c31\u4e0d\u9700\u8981\u4e86\u3002\u4e4b\u524d\u6ca1\u6709\u5220\u51cf\u7684\u90a3\u4e2a\u6848\u4f8b\u91cc\u9762\u7528\u5230\u4e86\u8fd9\u4e2a\u3002\u8bf4\u8d77\u6765\u597d\u5fc3\u75bc~~~<\/p>\n\n\n\n<p>3.2.3 \u76f8\u673a\u4f7f\u7528<\/p>\n\n\n\n<p>\u76f8\u673a\u5728\u8fd9\u4e2a\u6848\u4f8b\u91cc\u9762\uff0c\u4f7f\u7528\u7684\u662f<code>AVFoundation<\/code>\u6846\u67b6\u3002\u4e5f\u662f\u5f88\u5fc3\u75db\uff0c\u8fd9\u90e8\u5206\u4e4b\u524d\u6ca1\u6709\u5206\u4eab\u8fc7\u3002\u6240\u4ee5\u5982\u679c\u7b49\u4e0d\u53ca\u4ffa\u7684\u5206\u4eab\uff0c\u53ef\u4ee5\u5148\u770b\u770b\u8fd9\u4e2a\u3002Objc\u7684\u7b2c21\u671f\u5185\u5bb9\uff1a<a href=\"https:\/\/link.jianshu.com?t=%5Bhttps:\/\/www.objccn.io\/issue-21-3\/\" target=\"_blank\" rel=\"noreferrer noopener\">iOS\u4e0a\u7684\u76f8\u673a\u6355\u6349<\/a><\/p>\n\n\n\n<p>\u522b\u5fd8\u4e86\u5728\u5934\u6587\u4ef6<code>&lt;AVFoundation\/AVFoundation.h&gt;<\/code>\uff0c\u540c\u65f6\u9075\u5b88\u4ee3\u7406\u534f\u8bae<code>AVCaptureVideoDataOutputSampleBufferDelegate<\/code>\u3002<\/p>\n\n\n\n<p>3.3 \u521b\u5efa\u52a8\u6001\u6d3b\u52a8\u7684\u661f\u7a7a\u80cc\u666f<\/p>\n\n\n\n<p>\u4ece\u7f51\u4e0a\u627e\u5230\u7684\u661f\u7a7a\u56fe\u662f4000*2800\u7684\u5927\u5c0f\uff0c\u8981\u8ba9\u5b83\u5b8c\u5168\u8d85\u51fa\u5c4f\u5e55\u3002\u8fd9\u6837\u624d\u80fd\u6839\u636e\u624b\u673a\u7684\u79fb\u52a8\u8fdb\u884c\u6d3b\u52a8\u3002<\/p>\n\n\n\n<p>\u540c\u6837\u7684\uff0c\u4e3a\u4e86\u80fd\u591f\u660e\u663e\u7684\u770b\u5230\u6548\u679c\uff0c\u5728\u4ece\u9640\u87ba\u4eea\u83b7\u53d6\u5230\u7684\u6570\u503c\u4e4b\u540e\uff0c\u6dfb\u52a0\u4e86\u4e00\u4e2a\u653e\u5927\u500d\u6570\u3002\u8fd9\u4e2a\u5c0f\u4f8b\u5b50\u91cc\u9762\u54b1\u4eec\u4f7f\u7528\u7684\u662f5\u3002<\/p>\n\n\n\n<p>3.3.1 \u4f7f\u7528\u9640\u87ba\u4eea\u8fdb\u884c\u9632\u6296<\/p>\n\n\n\n<p>\u5982\u679c\u9640\u87ba\u4eea\u8fd4\u56de\u7684\u6570\u636e\u5728\u67d0\u4e2a\u7279\u5b9a\u5c0f\u8303\u56f4\u5185\uff0c\u6211\u4eec\u5c31\u662f\u89c6\u540c\u53ea\u662f\u624b\u6296\uff0c\u4e0d\u5bf9\u56fe\u7247\u672c\u8eab\u8fdb\u884c\u5904\u7406\u3002\u8fd9\u6837\u5c31\u770b\u4e0d\u5230\u80cc\u666f\u56fe\u7247\u660e\u663e\u6296\u52a8\u7684\u611f\u89c9\u4e86\u3002<\/p>\n\n\n\n<ul><li>\u6ce8\u610f\uff1a\u9640\u87ba\u4eea\u8fd4\u56de\u7684\u5404\u8f74\u65cb\u8f6c\u89d2\u5ea6\u662f\u6709\u53ef\u80fd\u4e3a\u8d1f\u6570\u7684\uff0c\u6240\u4ee5\u522b\u5fd8\u4e86\u7528\u7edd\u5bf9\u503c\u8fdb\u884c\u5224\u65ad\u3002<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/            \u505a\u4e00\u4e0b\u9632\u6296\u52a8\u7684\u5904\u7406\uff0c\u5982\u679c\u624b\u673a\u65cb\u8f6c\u7684\u4e0d\u592a\u5927\uff0c\u5c31\u4e0d\u6267\u884c\u64cd\u4f5c\nif (fabs(gyroData.rotationRate.x) * multiplier &lt; 0.2 &amp;&amp; fabs(gyroData.rotationRate.y) * multiplier &lt; 0.2) {\n    return ;\n}\n\n<\/pre>\n\n\n\n<p>3.3.2 \u8ba9\u80cc\u666f\u661f\u7a7a\u56fe\u968f\u7740\u5c4f\u5e55\u8fdb\u884c\u8fd0\u884c<\/p>\n\n\n\n<p>\u76f4\u63a5\u4fee\u6539\u80cc\u666f\u56fe\u7684center\u5c31\u597d\u4e86\uff0c\u8ba9\u539fcenter\u6dfb\u52a0\u4e0a\u9700\u8981\u8fdb\u884c\u7684\u4f4d\u79fb\u91cf\u5c31\u53ef\u4ee5\u5b9e\u73b0\u4e86\u3002<br>\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u9700\u8981\u5bf9\u8fb9\u754c\u503c\u8fdb\u884c\u5904\u7406\u3002\u5982\u679c\u5c4f\u5e55\u65cb\u8f6c\u7684\u4e71\u4e03\u516b\u7cdf\uff0c\u6211\u4eec\u8981\u8ba9\u89c6\u9891\u8f93\u51fa\u5c42\u4e0b\u9762\u59cb\u7ec8\u6709\u4e00\u4e2a\u80cc\u666f\u5b58\u5728\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">   \/\/            \u56e0\u4e3a\u80cc\u666f\u56fe\u7684\u5927\u5c0f\u4e8b\u5c4f\u5e55\u5bbd\u5ea6\u7684\u4e09\u500d\uff0c\u9ad8\u5ea6\u7684\u4e24\u500d\u3002\u4e3a\u4e86\u9632\u6b62\u8d85\u51fa\u8fb9\u754c\uff0c\u8fdb\u884c\u9650\u5236\n            if (imageRotationX > self.view.frame.size.width * 1.5) {\n                imageRotationX = self.view.frame.size.width * 1.5;\n            }\n            \n            if(imageRotationX &lt; (- self.view.frame.size.width * 0.5)){\n                imageRotationX=(- self.view.frame.size.width * 0.5);\n            }\n            \n            if (imageRotationY > self.view.frame.size.height) {\n                imageRotationY = self.view.frame.size.height;\n            }\n            if (imageRotationY &lt; 0) {\n                imageRotationY = 0;\n            }\n<\/pre>\n\n\n\n<p><strong>3.4 \u5229\u7528\u767e\u5ea6\u5730\u56fe\u8f93\u51fa\u78c1\u529b\u8ba1\u4fe1\u606f\u3001\u7ecf\u7eac\u5ea6\u3001\u9ad8\u5ea6<\/strong><\/p>\n\n\n\n<p>3.4.1 \u8f93\u51fa\u78c1\u529b\u8ba1\u4fe1\u606f<\/p>\n\n\n\n<p>\u6839\u636e\u767e\u5ea6\u5730\u56feSDK\u7684\u6587\u6863\uff0c\u5728\u7528\u6237\u7684\u65b9\u5411\u4fe1\u606f\u653e\u751f\u53d8\u5316\u4e4b\u540e\uff0c\u4f1a\u8c03\u7528\u4ee5\u4e0b\u7684\u65b9\u6cd5\u3002<br>\u8fd9\u91cc\u6211\u4eec\u6ca1\u6709\u505a\u4efb\u4f55\u7279\u6b8a\u7684\u5904\u7406\uff0c\u5c31\u53ea\u662f\u7b80\u5355\u7684\u6253\u5370\u51fa\u6765\u4e86\u78c1\u5317\u3001\u771f\u5317\u3001\u4e09\u8f74\u7684\u504f\u79fb\u91cf\u3002<\/p>\n\n\n\n<p>\u7b49\u4f1a\u513f\u8fd0\u884c\u7684\u65f6\u5019\u5927\u5bb6\u5c31\u80fd\u770b\u5230\u4e4b\u524d\u7684\u95ee\u9898\uff0c\u5230\u5e95\u78c1\u5317\u3001\u771f\u5317\u4e4b\u95f4\u76f8\u5dee\u591a\u5c11\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/**\n *\u7528\u6237\u65b9\u5411\u66f4\u65b0\u540e\uff0c\u4f1a\u8c03\u7528\u6b64\u51fd\u6570\n *@param userLocation \u65b0\u7684\u7528\u6237\u4f4d\u7f6e\n *\/\n- (void)didUpdateUserHeading:(BMKUserLocation *)userLocation {\n    self.magnetometerInfo.numberOfLines = 0;\n    self.magnetometerInfo.text = [NSString stringWithFormat:@\"\u78c1\u5317\uff1a%.0f,\u771f\u5317\uff1a%.0f \\n\u504f\u79fb\uff1a%.0f \\nx:%.1f y:%.1f z:%.1f\",\n                                  userLocation.heading.magneticHeading,userLocation.heading.trueHeading,userLocation.heading.headingAccuracy,userLocation.heading.x,userLocation.heading.y,userLocation.heading.z];\n}\n\n<\/pre>\n\n\n\n<p>3.4.2 \u8f93\u51fa\u7528\u6237\u4f4d\u7f6e\u4fe1\u606f\uff1a\u7ecf\u7eac\u5ea6\u3001\u9ad8\u5ea6<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/**\n *\u7528\u6237\u4f4d\u7f6e\u66f4\u65b0\u540e\uff0c\u4f1a\u8c03\u7528\u6b64\u51fd\u6570\n *@param userLocation \u65b0\u7684\u7528\u6237\u4f4d\u7f6e\n *\/\n- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation\n{\n    self.physicalLocation.numberOfLines = 0;\n    self.physicalLocation.text = [NSString stringWithFormat:@\"\u7ecf\u5ea6:%f \\n\u7eac\u5ea6:%f \\n\u9ad8\u5ea6:%f\",userLocation.location.coordinate.longitude,userLocation.location.coordinate.latitude,userLocation.location.altitude];\n}\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u54b1\u4eec\u5c31\u7528\u7528\u7b2c\u4e09\u4e2a\u4f20\u611f\u5668&#8211;\u78c1\u529b\u8ba1&#8211;\u6765\u505a\u4e00\u4e2aAR\u7684\u573a\u666f\u3002\u8bf4\u5230AR\u8fd9\u4e2a\u8bcd\uff0c\u8bf7\u5927\u5bb6\u4e0d\u8981\u55b7\u6211 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/5814"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5814"}],"version-history":[{"count":1,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/5814\/revisions"}],"predecessor-version":[{"id":5821,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/5814\/revisions\/5821"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}