![](/img/trans.png)
[英]Integrate react-native version 0.62.2 into existing IOs app error
[英]“_fbBatchedBridge is undefined” error while trying to integrate a react-native app with an existing ios app
將本機集成到現有的ios應用中。 我有一個本地ios應用程序,可從遠程服務器中提取ios捆綁包。 我按照react-native網站( https://facebook.github.io/react-native/docs/embedded-app-ios.html )上的說明進行操作,並且能夠在React中安裝pod依賴項並啟動ios應用程序在模擬器中。
當我導航到加載react-native提供的視圖的視圖時,用於在該視圖中加載react-native應用程序的代碼如下所示
NSString *urlString = @"https://<some_url_here>/main.jsbundle"; //a remotely hosted bundle.
NSURL *jsCodeLocation = [NSURL URLWithString:urlString];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName: @"react-native-app"
initialProperties: nil
launchOptions:nil];
當我直接點擊https://<some_url_here>/main.jsbundle
我確實看到捆綁包被放低了,所以我確實知道該URL確實為捆綁包服務。
我看到的問題是當我嘗試加載視圖時,出現紅色屏幕:
_fbBatchedBridge is undefined
當我在網上搜索此問題時,當應用程序嘗試從dev-server中拉出捆綁包但dev-server未運行時,似乎發生了此問題。 這不適用於我的情況,因為該捆綁包是遠程托管的。
關於可能出什么問題的任何想法?
這可能是與ATS(應用程序傳輸安全性)相關的問題。 嘗試針對要連接的域禁用它,僅用於調試。
在您的Info.plist中:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>www.the-domain-name.com</key>
<dict>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.0</string>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
Xamarin對於完善ATS設置有很好的解釋 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.