大家好,升级到RN 0.60.X时遇到了问题。
我的项目最初没有cocoapods,所以我安装了它们(https://guides.cocoapods.org/using/using-cocoapods.html),并开始使用XXXX.xcworkspace文件和XXXX.xcodeproj。
要构建所有内容,我基本上需要从链接的框架和库中删除所有东西,除了libpods-XXX.a,JavaScriptCore.framework和libRCTPushNotifications。
因此,在这一点上,我有一个如下所示的podfile:
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'XXX' do
# Pods for XXX
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/React'
pod 'React-DevSupport', :path => '../node_modules/react-native/React'
pod 'React-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
#pod 'React-RCTPushNotification', :path => '../node_modules/react-native/Libraries/PushNotificationIOS'
#pod 'EmailValidator', :path=> '../node_modules/email-validator'
#pod 'libPhoneNumber-iOS'
target 'XXXTests' do
inherit! :search_paths
# Pods for testing
end
use_native_modules!
end
target 'XXX-tvOS' do
# Pods for XXX-tvOS
target 'XXX-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
一切都建立了,我运行了我的应用程序,但得到了:没有URL捆绑包。
2019-08-05 09:37:29.744 [info][tid:main][RCTCxxBridge.mm:236] Initializing <RCTCxxBridge: 0x7fa27dc00bf0> (parent: <RCTBridge: 0x6000010c9110>, executor: (null))
2019-08-05 09:37:29.897 [fatal][tid:main] No bundle URL present.
Make sure you're running a packager server or have included a .jsbundle file in your application bundle.
我的appDelegate.m中包含以下行
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
有什么办法让捆绑包显示出来吗?
我做了一些骇人听闻的事情:
react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
然后将main.jsbundle和资产拖到工作区中
,当我得到一些捆绑连接时,它会告诉我没有本机模块。