我正在尝试使用 Microsoft Code Push 更新 JS 捆绑包,而无需再次将应用程序提交到 iTunes。
在调试和发布模式下,应用程序可以通过代码推送成功加载捆绑包并在下次启动时安装更新。
与调试/发布 Xcode 应用程序不同,当我存档应用程序并从 TestFlight 安装它时,我在本机启动画面之后遇到了白色的空白屏幕。应用程序中心没有出现崩溃。
在添加代码推送支持之前我没有使用过 Cocoapod,所以我不信任 Podfile,而且我在这方面完全是新手。
Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for MyApp
pod 'yoga', path: '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'GLog', :podspec => '../node_modules/react-native/third-party-podspecs/GLog.podspec'
pod 'React', path: '../node_modules/react-native', subspecs: [
'DevSupport',
]
pod 'AppCenter/Crashes', '~> 1.7.1'
pod 'AppCenter/Analytics', '~> 1.7.1'
pod 'AppCenterReactNativeShared', '~> 1.6.0'
pod 'CodePush', :path => '../node_modules/react-native-code-push'
platform :ios, '9.0'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'MyApp-tvOS' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for MyApp-tvOS
target 'MyApp-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
我刚刚通过 TestFlight 构建解决了类似的问题。
我能够使用react-native run-ios命令将我的应用程序本地部署到我的设备并接收CodePush更新,但每当我发布TestFlight的版本时,该应用程序都没有收到更新。
问题是我的 CodePush 目标版本与 Xcode 中的版本不匹配。您可以通过更改常规 -> 身份 -> 版本下的版本以匹配 CodePush 中的目标版本来解决此问题。或者您也可以更改 CodePush 中部署的目标版本以匹配 Xcode 中的版本。
此外,您可以在部署命令中通过 -t 标志和版本号配置 CodePush 目标版本。
appcenter codepush release-react -t '0.1.0' ...