我们最近在ReactNative App中升级了所有库,并且我们使用 RN v0.59.8 和XCode v 10.3(10G8),一切正常,我们能够使用开发证书甚至带有Adhoc配置文件的发行证书来构建和运行该应用。

但是,当我们尝试提交到应用商店时,存档后,该应用始终列在“其他项目”下,而不是在iOS应用下。存档的类型始终显示为通用Xcode存档,这是错误的。

当我们检查为什么禁用“验证和上传到应用商店”按钮时,我们发现apple technical document

根据文档中的建议,我们执行以下步骤:

  • 对构建设置下的所有静态库跳过安装否
  • 将所有头文件从“头文件”构建阶段移至“复制文件”构建阶段

  • 第二步是一件繁琐的工作,因为我们必须手动处理所有静态库。

    这样做之后,我们开始遇到大量编译错误,例如NativeModule.h中的MethodDescriptor重新定义

    查看错误->
    ios - ReactNative 0.59.8项目-应用商店发布时无法为iOS存档-LMLPHP

    有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中的Application Loader上载它。

    我不记得我发现的所有资源都可以帮助我解决这一问题,但这只是其中之一:How to build .ipa application for react-native-ios?

    本质上,在完成清洁构建文件夹之后,然后在清洁构建之后,您可以在以下位置找到.app文件:
    〜/库/开发人员/ Xcode / DerivedData // Build / Products / Release-iphoneos /

    在桌面上创建一个名为Payload的新文件夹(此名称区分大小写)

    复制您的.app文件,并将副本粘贴到此Payload文件夹中。

    右键单击该文件夹,然后选择“压缩有效负载”

    保存此文件时,请勿将其保存为.zip扩展名,而应将其保存为.ipa扩展名。

    现在,这是您的应用程序的.ipa文件,您可以通过Xcode Application Loader上载该文件。

    上传过程会告诉您您的构建是否有问题,但如果没有问题,它将上传至应用商店,稍后您应该可以在App Store Connect中找到它。

    希望这对您和/或其他人有帮助!

    关于ios - ReactNative 0.59.8项目-应用商店发布时无法为iOS存档,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57488993/

    10-11 22:38
    查看更多