ios - 从 iOS 上的 React Native 应用程序访问 NSUserDefaults
<p><p>我有一个使用 ExpoKit 的 React Native 应用程序。如果需要,我可以弹出。</p>
<p>我想访问 NSUserDefaults 对象以读取已由 AirWatch(移动设备管理系统)推送的值。基本上,该应用程序在托管环境中运行,并且设置通过 NSUserDefaults 传递。</p>
<p>我无法使用 React Native 的 <code>Settings</code> ( <a href="https://facebook.github.io/react-native/docs/settings" rel="noreferrer noopener nofollow">https://facebook.github.io/react-native/docs/settings</a> ),因为它给了我一个关于内部 <code>_settings</code> 对象在尝试访问 <code>this._settings</code>.</p>
<p>如何使用这个设置模块,或者我应该怎么做才能访问这个设置对象?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>检查你的 pod,你很可能错过了 pod 'React' 的子规范“RCTSettings”,它没有在弹出期间添加......这真的很奇怪。 </p>
<p>这就是我的样子:</p>
<pre><code>pod 'React',
:path => "../node_modules/react-native",
:inhibit_warnings => true,
:subspecs => [
"Core",
"ART",
"RCTActionSheet",
"RCTAnimation",
"RCTCameraRoll",
"RCTGeolocation",
"RCTImage",
"RCTNetwork",
"RCTText",
"RCTVibration",
"RCTWebSocket",
"RCTSettings",
"DevSupport",
"CxxBridge"
]
</code></pre></p>
<p style="font-size: 20px;">关于ios - 从 iOS 上的 React Native 应用程序访问 NSUserDefaults,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/55132635/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/55132635/
</a>
</p>
页:
[1]