ReactNative 0.59.8 project – unable to archive for for iOS while app store release & Validate Buttons is always grayed out

http://knowledge-cess.com/reactnative-0-59-8-project-unable-to-archive-for-for-ios-while-app-store-release-validate-buttons-is-always-grayed-out/

Recently we faced a very strange issue while releasing our ReactNative App to Apple App Store. We were unable to submit the app to iOS app store because we were failing to generate iOS Archive. XCode always generating Generic XCode Archive rather than iOS App Archive.

Since XCode was generating Generic XCode Archive, Validate button was always disabled ( grayed out). We were failing to proceed further to submit the app. After exploring the issue we came across an apple help page which was suggesting following fixes to be done for our app.

  1. Your archive contains header files.

If your app links against a static library, then your archive contains header files because the library probably uses a Headers build phase to export these files as shown in Figure 4. Headers build phases do not work correctly with static library targets when archiving in Xcode. Delete this phase, add a Copy Files build phase to your library, and use it to export your header files. See Copying Files While Building a Product for more information about adding a Copy File build phase to your project.

 2. Your archive contains static libraries or frameworks.

You must set “Skip Install” to YES to prevent your static libraries or framework from being added to your archive.

the second step was little easy , however the first step was a big headache, a react native app will be having lot of static libraries, in that changing all header build phase to copy files build phase is a big manual work and we will get lot of compilation errors like Redenition of MethodDescriptor in NativeModule.h kind of.

Errors we see after moving header files from headers build phase to copy files build phase

Redefinition of iOS errors

Redefinition of iOS errors

 

Solution : How to release iOS app to app store when archive is troubling in XCode

We have to follow different approach to release the app.

There is another way to upload your app build to the app store: by creating an .ipa file of your app, and uploading it through Application Loader in Xcode ( just click cmd + space in your mac machine and search Application Loader ).

I don’t remember all the resources I found that helped me figure this out, but this was one of them: How to build .ipa application for react-native-ios?

Essentially, after you do the Clean Build Folder, and then Build, you find the .app file in: ~/Library/Developer/Xcode/DerivedData//Build/Products/Release-iphoneos/

Create a new folder on your desktop named Payload (this name is case-sensitive)

Copy your .app file and paste the copy in this Payload folder.

Right click the folder and choose “Compress Payload”

When you save this, do not save it with the .zip extension, but instead save it with a .ipa extension.

This is now your .ipa file for your app, and you can upload this through Xcode Application Loader.

    NOTE: Application loader asks for app specific password , kindly refer to generate app specific password -> https://www.imore.com/how-generate-app-specific-passwords-iphone-ipad-mac

The upload process will tell you if there is anything wrong with your build, but if there is not, it will upload to the app store and you should be able to find it in App Store Connect in a few moments.

Hope this helps you and/or others!

Thanks to Matthew Hall for answering in Stackoverflow -> https://stackoverflow.com/a/57532876/526438