ios - react native [[DEFAULT]] firebaseapp 未初始化 react-native-firebase
<p><p>我正在尝试将 react-native-firebase 模块与 react native 一起使用。 </p>
<p>我得到的错误:</p>
<p> <a href="/image/Tjvxr.png" rel="noreferrer noopener nofollow"><img src="/image/Tjvxr.png" alt="enter image description here"/></a> </p>
<p>我遵循的步骤:</p>
<p>Step1:创建基本应用程序</p>
<pre><code>react-native init myFirebaseApp
</code></pre>
<p>移至项目</p>
<pre><code>cd myFirebaseApp
</code></pre>
<p>已安装的模块</p>
<pre><code>npm install --save react-native-firebase
</code></pre>
<p>第 2 步:设置 Firebase SDK (<a href="https://rnfirebase.io/docs/v4.2.x/installation/ios" rel="noreferrer noopener nofollow">https://rnfirebase.io/docs/v4.2.x/installation/ios</a>)</p>
<p>创建了 Firebase 应用并下载了适用于 iOS 的 GoogleService-Info.plist</p>
<p>复制</p>
<blockquote>
<p>GoogleService-Info.plist</p>
</blockquote>
<p>在项目中,然后</p>
<pre><code>pod init
</code></pre>
<p>将这些行添加到 pod 文件中</p>
<pre><code>pod 'Firebase/Core'
pod 'Firebase/Firestore'
</code></pre>
<p>已安装的依赖项</p>
<pre><code>pod install
</code></pre>
<p>最后是链接库</p>
<pre><code>react-native link
</code></pre>
<p>有人可以指导我缺少什么或做错了什么?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>修改您的 <code>AppDelegate.h</code> 和 <code>AppDelegate.m</code> 文件</p>
<p>在<code>AppDelegate.h</code>中添加这个,</p>
<pre><code>#import <Firebase.h>
</code></pre>
<p>并在<code>AppDelegate.m</code>中添加<code>;</code></p>
<pre><code>#import <React/RCTRootView.h>
#import <ReactNativeNavigation/ReactNativeNavigation.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
; // <=== Add this line
NSURL *jsCodeLocation = [ jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
;
return YES;
}
@end
</code></pre></p>
<p style="font-size: 20px;">关于ios - react native [] firebaseapp 未初始化 react-native-firebase,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/50815094/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/50815094/
</a>
</p>
页:
[1]