菜鸟教程小白 发表于 2022-12-11 22:26:50

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 &#39;React&#39;,
:path =&gt; &#34;../node_modules/react-native&#34;,
:inhibit_warnings =&gt; true,
:subspecs =&gt; [
&#34;Core&#34;,
&#34;ART&#34;,
&#34;RCTActionSheet&#34;,
&#34;RCTAnimation&#34;,
&#34;RCTCameraRoll&#34;,
&#34;RCTGeolocation&#34;,
&#34;RCTImage&#34;,
&#34;RCTNetwork&#34;,
&#34;RCTText&#34;,
&#34;RCTVibration&#34;,
&#34;RCTWebSocket&#34;,
&#34;RCTSettings&#34;,
&#34;DevSupport&#34;,
&#34;CxxBridge&#34;
]
</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]
查看完整版本: ios - 从 iOS 上的 React Native 应用程序访问 NSUserDefaults