我们最近升级了 ReactNative 应用程序中的所有库,并且使用 RN v0.59.8 和 XCode v 10.3 (10G8),一切正常,我们能够通过开发来构建和运行应用程序证书甚至带有 Adhoc 配置文件的分发证书。
但是,当我们尝试提交到应用程序商店时,存档后,该应用程序始终列在“其他项目”下,而不是列在 iOS 应用程序下。存档类型始终显示为通用 Xcode 存档,这是错误的。
当我们检查验证和上传到应用商店按钮被禁用的原因时,我们发现apple technical document
根据文档中给出的建议,我们按照以下步骤操作:
- make Skip install 对于build设置下的所有静态库均否
- 将所有头文件从 header 构建阶段移动到复制文件构建阶段
第二步是一项有点繁琐的工作,因为我们必须手动为所有静态库执行此操作。
这样做之后,我们开始收到大量编译错误,例如 NativeModule.h 中 MethodDescriptor 的 Redefinition
此类错误超过 600 多个。 请帮我解决这个问题
这是我的 Pod 文件
# Uncomment the next line to define a global platform for your project
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
#use_frameworks!
target 'SociallyGood' do
# this is very important to have!
rn_path = '../node_modules/react-native'
rn_maps_path = '../node_modules/react-native-maps'
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
pod 'React', path: rn_path, subspecs: [
'ART',
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
'DevSupport'
]
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# pod 'GoogleMaps' # <~~ remove this line if you do not want to support GoogleMaps on iOS
# Pods for SociallyGood
pod 'react-native-maps', path: rn_maps_path
pod 'react-native-google-maps', path: rn_maps_path # If you need GoogleMaps support on iOS
# pod 'GoogleAppMeasurement', '5.4'
pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker'
pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'
pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
pod 'RNShare', :path => '../node_modules/react-native-share'
pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'
pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
pod 'GoogleSignIn', '~> 4.4.0'
# pod 'GoogleUtilities', '~> 1.3'
# pod 'GoogleAuthUtilities'
# pod 'GoogleAppUtilities'
pod 'FacebookSDK'
pod 'FBSDKCoreKit', '~> 4.40.0'
pod 'FBSDKLoginKit', '~> 4.40.0'
pod 'FBSDKShareKit', '~> 4.40.0'
# Required by RNFirebase
pod 'Firebase/Core', '~> 5.20.2'
pod 'Firebase/Auth', '~> 5.20.2'
# very important to have, unless you removed React dependencies for Libraries
# and you rely on Cocoapods to manage it
# pod 'RNGoogleSignin', :path => '../node_modules/react-native-google-signin'
pod 'BugsnagReactNative', :path => '../node_modules/bugsnag-react-native'
# pod 'react-native-maps', :path => '../node_modules/react-native-maps'
# pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
pod 'RNScreens', :path => '../node_modules/react-native-screens'
pod 'react-native-webview', :path => '../node_modules/react-native-webview'
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
end
最佳答案
当我尝试向应用商店发布我的第一个 RN 应用程序时,我也遇到了同样的困难。我的存档版本始终列在“其他项目”下
我花了一段时间才找到答案,但这就是我现在所做的:
还有另一种方法可以将应用程序版本上传到应用程序商店:创建应用程序的 .ipa 文件,然后通过 Xcode 中的应用程序加载器上传它。
我不记得我找到的所有资源可以帮助我解决这个问题,但这就是其中之一:How to build .ipa application for react-native-ios?
本质上,在执行清理构建文件夹,然后构建之后,您会在以下位置找到 .app 文件: 〜/Library/Developer/Xcode/DerivedData//Build/Products/Release-iphoneos/
在桌面上创建一个名为 Payload 的新文件夹(此名称区分大小写)
复制您的 .app 文件并将副本粘贴到此 Payload 文件夹中。
右键单击该文件夹并选择“压缩有效负载”
保存时,不要使用 .zip 扩展名保存,而是使用 .ipa 扩展名保存。
这现在是您应用程序的 .ipa 文件,您可以通过 Xcode 应用程序加载器上传该文件。
上传过程会告诉您构建是否有任何问题,但如果没有,它将上传到应用商店,您应该很快就能在 App Store Connect 中找到它。
希望这对您和/或其他人有帮助!
关于ios - ReactNative 0.59.8 项目 - 应用商店发布时无法存档 iOS 版,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57488993/