maps icon indicating copy to clipboard operation
maps copied to clipboard

iOS 8.1.0-rc: Xcode 'Archive' produces a corrupt archive

Open sampok opened this issue 6 years ago • 80 comments

Describe the bug iOS: Xcode 'Archive' produces a corrupt archive. Seems to be possibly related to iOS Mapbox SDK 5.8. Found a workaround, see below.

To Reproduce

  • npx react-native init RNMapboxTest
  • cd RNMapboxTest
  • yarn add @react-native-mapbox-gl/maps
  • cd ios && pod install
  • Open ios/RNMapboxTest.xcworkspace in Xcode
  • Set build to 'Any iOS Device' and set signing
  • Build with Product > Archive. Wait.
  • Build completes without errors, but it doesn't show up in Organizer
  • When trying to open the build from /Library/Developer/Xcode/Archives, get error 'The archive may be corrupt or unreadable.'

Expected behavior Expecting to be able to build an Archive for App Store submission.

Screenshots Screen Shot 2020-11-03 at 10 27 14 AM

Versions

  • Platform: iOS
  • Xcode: 12.1
  • react-native-mapbox-gl Version 8.1.0-rc.9
  • React Native Version 0.63.3

Possible reason & Workaround

  • When using react-native-mapbox-gl v 8.0.0, the archive build works. However I need the padding fixes in 8.1 rcs, so I continued looking.
  • Noticed that 8.0.0 installed Mapbox iOS SDK 5.9.0, whereas 8.1.0-rc.9 installs 5.8.0. This is because in 8.0.0 podspec the SDK dependency is defined without a 'patch' number, like this: '~> 5.7', leading to installation of the latest 5.X version. In 8.1.0-rc.9 it's defined with a patch: '~> 5.8.0', installing version 5.8.X.
  • Learned about $ReactNativeMapboxGLIOSVersion to explicitly set the iOS SDK version. However, it seems to apply also to some other dependencies, and if you set it to '~> 5.9.0', @react-native-mapbox-gl-mapbox-static fails to install. However setting it to '~> 5.8' leads to install of Mapbox iOS SDK 5.9.0 and latest 5.X for others. And now archive build works correctly!
  • So the workaround for me was simply to add $ReactNativeMapboxGLIOSVersion = '~> 5.8' into the Podfile, and pod install.

sampok avatar Nov 03 '20 16:11 sampok

The Archive build gets corrupted again if I set Mapbox iOS SDK to 6.X version (using $ReactNativeMapboxGLIOSVersion).

It's quite annoying as 5.9 has a symbols flickering while zooming out issue, which 5.8 didn't have, and it's fixed in 6.X.

sampok avatar Nov 04 '20 00:11 sampok

It's strange that the app builds fine with all Mapbox iOS SDK versions for Debug and Release, but with Archive it becomes corrupted (except with 5.9.0).

When I peek inside the generated .xcarchive file that Archive creates, I see that the 'corrupted ones' lack Info.plist file and SCMBlueprint folder with .xcscmblueprint file inside it. Also BCSymbolsMaps folder seems to have less items.

The Archive process completes without any errors. It does have a lot of warnings, but they look like kind of "normal" for React Native builds.

sampok avatar Nov 04 '20 01:11 sampok

I can confirm that is also happening with rc6 and rc9 i did not check the rest. i need rc6 for the padding fixing of the ios.

SalihZinaty avatar Nov 04 '20 09:11 SalihZinaty

I've noticed a similar issue on AppCenter:

error: archive at path '<snip>' is malformed
** EXPORT FAILED **

Tried pinning to ~> 5.8 but instead of a malformed archive, I now get the following error:

Print: Entry, "CFBundleIdentifier", Does Not Exist
##[error]Failed to automatically generate an `Export options` plist file to export an IPA. Please specify an `Export options` plist file in `Package options`.

If I downgrade to 8.1.0-rc.4 the archiving succeeds though.

cbrevik avatar Nov 04 '20 20:11 cbrevik

If I downgrade to 8.1.0-rc.4 the archiving succeeds though.

I guess a possible, even likely (?) explanation is that in rc4 the Mapbox SDK version was defined without a patch number, and now resolves to the highest minor version, i.e. 5.9.0. (rc4 to rc5 diff)

sampok avatar Nov 04 '20 21:11 sampok

I've been struggling with this too for a bit, and I found that downgrading cocoapods from version 1.10.0 to 1.9.3 fixed the corrupt archive issues above. The command I used:

gem install cocoapods -v '<= 1.9.3' -n /usr/local/bin
  • react-native-mapbox-gl Version 8.1.0-rc.8
  • React Native Version 0.63.2

chriscohoat avatar Nov 05 '20 04:11 chriscohoat

We had similar issues with react-native-mapbox-gl 8.0.0 and the cocoapods downgrade to 1.9.3 resolved those as well. 1.10.0 did not create a valid archive.

tomihuttunen avatar Nov 05 '20 07:11 tomihuttunen

I've tried downgrading our Podfile.lock to 1.9.3, but I am unsure if the AppCenter VMs will use 1.9.3 in that case. It failed even with the downgrade, in any case. They have 1.10.0 installed by default it seems - so I'm a bit unsure of how to verify on my end.

cbrevik avatar Nov 05 '20 08:11 cbrevik

Yes Appcenter does not respect the Podfile.lock version and will use whatever is installed to the runner machine. And the version was just upgraded to 1.10.0 and that is when my problems started.

I used this script to enforce to use the version defined in the Podfile.lock. Which is in general better because now I can be in control what is used.

https://github.com/microsoft/appcenter/blob/master/sample-build-scripts/react-native/compare-cocoapods/appcenter-post-clone.sh

tomihuttunen avatar Nov 05 '20 12:11 tomihuttunen

The Archive build gets corrupted again if I set Mapbox iOS SDK to 6.X version (using $ReactNativeMapboxGLIOSVersion).

Turns out that it's possible use Mapbox iOS SDK 6.X and avoid corruption with $ReactNativeMapboxGLIOSVersion = '~> 6.2.1'

Previously I pinned to exact version '6.2.1' because the latest version 6.2.2 crashes in Xcode Release build on armv7 device. But it seems to work fine when using Archive and testing through TestFlight 🤷‍♂️..

sampok avatar Nov 05 '20 16:11 sampok

Downgrading to cocoapods 1.9.3 fixed this for me!

naftalibeder avatar Nov 11 '20 22:11 naftalibeder

Downgrading to cocoapods 1.9.3 fixed this for me!

I have the same problem. Downgrading is working for me too

westanvv avatar Nov 23 '20 11:11 westanvv

Downgrading to Cocoapods 1.9.3 also fixed this issue for me. Has anyone manage to get this working with Cocoapods 1.10.0?

samjusaitis avatar Dec 13 '20 22:12 samjusaitis

Going back to 1.9.3 fixed it for us too

aprilzero avatar Dec 27 '20 18:12 aprilzero

Quick note for other folks looking for this: I was able to get this working without overwriting my global cocoapods install by using a Gemfile with the following contents in the RN ios folder:

source 'https://rubygems.org'

# use cocoapods v 1.9.3 as work-around for mapbox issues when archiving
# https://github.com/react-native-mapbox-gl/maps/issues/1097
gem 'cocoapods', '~> 1.9.3'

Then instead of the usual pod install command, use bundle exec pod install.

patternleaf avatar Jan 05 '21 16:01 patternleaf

There is a conflicting issue with the latest AppCenter packages though as they require 1.10.X to archive. Anybody got this to work with any of the AppCenter packages on 4.0.X?

luskin avatar Jan 19 '21 20:01 luskin

Any news on this? I keep using 1.9.3 for this project and 1.10.1 for my other projects

bottle-rocket-11 avatar Jan 22 '21 22:01 bottle-rocket-11

Was somebody able to report this issue in the cocoapods repository? I cant find any related issues 😞

acecilia avatar Jan 27 '21 13:01 acecilia

after running pod install command getting this error ruby download_file_async': undefined method `encode' for URI:Module (NoMethodError) due to that pod install not successfull.

Quick note for other folks looking for this: I was able to get this working without overwriting my global cocoapods install by using a Gemfile with the following contents in the RN ios folder:

source 'https://rubygems.org'

# use cocoapods v 1.9.3 as work-around for mapbox issues when archiving
# https://github.com/react-native-mapbox-gl/maps/issues/1097
gem 'cocoapods', '~> 1.9.3'

Then instead of the usual pod install command, use bundle exec pod install.

after following these steps and run the commad bundle exec pod install getting this error under ruby folder download_file_async': undefined method `encode' for URI:Module (NoMethodError) under ruby folder, please help Thanks

ruby version - 3.0.0 cocoapods - 1.9.3

SanjanaTailor avatar Jan 29 '21 14:01 SanjanaTailor

Using COCOAPODS: 1.10.1 and @react-native-mapbox-gl/maps": "8.1.0"

I had the exact same problem (archive succeed but actually malformed) Just open the xcarchive and you'll see there are missing parts (the plist for example).

The trick for me was to remove the copy dsym build phase of the @react-native-mapbox-gl-mapbox-static pod

This phase was causing build failure with some config and malformed archive with others, I don't really get the crux of the problem but may be it can help some of you...

acaraty avatar Jan 29 '21 21:01 acaraty