我正在使用firestore来检索/存储反应原生应用程序的一些消息 . 一切都在Android上按预期工作,但在iOS上我只能看到缓存的消息 . 该应用程序配置没有cocoapods,任何本机库已手动链接 .
我的想法是,我缺少某种参数来允许请求对firebase域的请求,或者我的firebase配置可能不正确 . 我的plist文件和调用firestore的代码都列在下面 . 我缺少任何选项/属性吗?
下面是从firestore集合中检索数据的代码
firebase.firestore().collection('messages')
.orderBy('timestamp', 'asc')
.limit(50)
.onSnapshot(snapshot => {
console.log('On Fetch...')
let newState = {
messages: []
};
snapshot.forEach(function(doc) {
newState.messages.push({
id: doc.id,
message: doc.data().message
});
});
});
以下是我的GoogleService-Info.plist文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AD_UNIT_ID_FOR_BANNER_TEST</key>
<string>...</string>
<key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key>
<string>...</string>
<key>CLIENT_ID</key>
<string>...</string>
<key>REVERSED_CLIENT_ID</key>
<string>...</string>
<key>API_KEY</key>
<string>...</string>
<key>GCM_SENDER_ID</key>
<string>...</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>...</string>
<key>PROJECT_ID</key>
<string>...</string>
<key>STORAGE_BUCKET</key>
<string>myapp.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<true/>
<key>IS_ANALYTICS_ENABLED</key>
<false/>
<key>IS_APPINVITE_ENABLED</key>
<false/>
<key>IS_GCM_ENABLED</key>
<true/>
<key>IS_SIGNIN_ENABLED</key>
<true/>
<key>GOOGLE_APP_ID</key>
<string>...</string>
<key>DATABASE_URL</key>
<string>https://myapp.firebaseio.com</string>
</dict>
</plist>
下面是我的Info.plist文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleDisplayName</key>
<string>...</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>10</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>appspot.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>firebaseio.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSCameraUsageDescription</key>
<string></string>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSMicrophoneUsageDescription</key>
<string></string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>