Closed sampok closed 3 years ago
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.
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.
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.
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.
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)
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
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.
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.
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.
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 π€·ββοΈ..
Downgrading to cocoapods 1.9.3
fixed this for me!
Downgrading to cocoapods
1.9.3
fixed this for me!
I have the same problem. Downgrading is working for me too
Downgrading to Cocoapods 1.9.3
also fixed this issue for me. Has anyone manage to get this working with Cocoapods 1.10.0
?
Going back to 1.9.3 fixed it for us too
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
.
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
?
Any news on this? I keep using 1.9.3 for this project and 1.10.1 for my other projects
Was somebody able to report this issue in the cocoapods repository? I cant find any related issues π
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, usebundle 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
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...
The root cause for the malformed archive is probably this: https://github.com/CocoaPods/CocoaPods/issues/10385 The root cause for the build issues may be this: https://github.com/CocoaPods/CocoaPods/issues/10373
thanks @acecilia it really looks like the same problems, I'll give a try to your workaround
sing COCOAPODS: 1.10.1 and @react-native-mapbox-gl/maps": "8.1.0"
Was somebody able to report this issue in the cocoapods repository? I cant find any related issues π
no not able to see facing same issue posted over here
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, usebundle 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 Thanksruby version - 3.0.0 cocoapods - 1.9.3
the copy dsym build phase of the @react-native-mapbox-gl-mapbox-static pod
@acaraty - can you explain from where it is resolved - The trick for me was to remove the copy dsym build phase of the @react-native-mapbox-gl-mapbox-static pod ?
@SanjanaTailor Fixed the issue in starter project with @react-native-mapbox-gl/maps. Below are configuration and versions used:
@SanjanaTailor
Removing the build phase fixed the malformed archive problem (in my case).
I'm not having errors when doing 'pod install' but I'm using an older ruby version (2.6), you might try to downgrade your ruby.
@acaraty - yes tried to downgrade Ruby version from 3.3.0 to 2.7.1 and without any error IPA generated.
@SanjanaTailor Fixed the issue in starter project with @react-native-mapbox-gl/maps. Below are configuration and versions used:
- @react-native-mapbox-gl/maps - 8.1.0
- Ruby - 2.7.1
- cocoapods - 1.9.3
- Xcode 12.2
Thank you @AmalMenachery Ruby version downgraded from 3.3.0 to 2.7.1 which resolved an issue of running this command below bundle exec pod install
and after that IPA generated successfully
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, usebundle 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
@AmalMenachery's answer refer it or @acaraty answer helped to resolved an issue. Now archiving worked succesfully.
@SanjanaTailor Fixed the issue in starter project with @react-native-mapbox-gl/maps. Below are configuration and versions used:
- @react-native-mapbox-gl/maps - 8.1.0
- Ruby - 2.7.1
- cocoapods - 1.9.3
- Xcode 12.2
This was really helpful unblocking me yesterday!
What is the longer term solution though? I imagine we can't just kick down our ruby/cocoapods version forever.
@ryderdonahue Please try to read the full issue before asking. Its probably a bug in cocoapods: https://github.com/react-native-mapbox-gl/maps/issues/1097#issuecomment-770071623
@ryderdonahue Please try to read the full issue before asking. Its probably a bug in cocoapods: #1097 (comment)
My bad, I should have been clearer. I had seen the reference to the linked cocoapods issues, but my unfamiliarity with the underlying tech caused me to miss the connection between the actual problem vs a related one.
Thanks for filing the issues on cocoapods @acecilia!
Thanks for various contributions above. Not being a Swift/Ruby expert, I did struggle to follow your example repo @acecilia and integrate into my React Native project.
Downgrading to v1.9.3 cocoapods fixed this issue for me, despite keeping @react-native-mapbox-gl/maps at v8.1.0.
Having had Cocoapods installed via Homebrew, I found it initially quite difficult to downgrade it (sudo errors), let alone manage multiple versions (so I could continue using newer Cocoapods on other projects).
However, for my Mac, using Ruby Version Manager did the trick.
gem uninstall cocoapods
and verify by running gem list
. If in doubt, search around your path and installations to be extra sure that you've removed all traces of it first.\curl -sSL https://get.rvm.io | bash -s stable
rvm install 2.7.0
and rvm use 2.7.0
pod install cocoapods -v 1.9.3
pod _1.9.3_ install
. This is handy as it will flag an error if it's not installed properly. I pop it a script within my package.json
One downside of doing this is that I've had to abandon Appcenter for building on iOS. I would guess you could get cloud building working on CircleCI, though I would warn that the installation (particularly of the pods) is pretty slow with the older version Cocoapods.
Could anyone recommend a quick cloud building solution that would allow you to specify your version of Cocoapods?
Best of luck to everyone, and love Mapbox!
@BenjaminWatts You can use app-center-post-clone.sh to enforce correct cocoapod version. Create a new file in the root of your project directory. Check the pod version in Podfile.lock as this is the one which will be used. It works and I did not notice any special extra time on build. Be aware that AppCenter does not recognize app-center-post-clone.sh unless you save new build settings.
This anser is just a summary of @tomihuttunen answer. Kudos to him!
appcenter-post-clone.sh
#!/usr/bin/env bash
CUR_COCOAPODS_VER=`sed -n -e 's/^COCOAPODS: \([0-9.]*\)/\1/p' ios/Podfile.lock`
ENV_COCOAPODS_VER=`pod --version`
# check if not the same version, reinstall cocoapods version to current project's
if [ $CUR_COCOAPODS_VER != $ENV_COCOAPODS_VER ];
then
echo "Uninstalling all CocoaPods versions"
sudo gem uninstall cocoapods --all --executables
echo "Installing CocoaPods version $CUR_COCOAPODS_VER"
sudo gem install cocoapods -v $CUR_COCOAPODS_VER
else
echo "CocoaPods version is suitable for the project"
fi;
Cheers @RobertSasak . That looks super helpful - I will give it a go. Wasn't aware of the --all --executables
options - suspect anyone trying to clean up local env (using my steps above) might find those helpful. PS - like norgeskart!
Just a tip, the standard solution for installing cocoapods in a specific version (and the easier one) is to use a Gemfile
and using it as explained here: https://github.com/react-native-mapbox-gl/maps/issues/1097#issuecomment-754757611
Installing cocoapods globally in a specific version is more complex and hacky :)
I have also downgrade. it's work fine thanks
Since React Native 0.64 (upcoming release) is not compatible with CocoaPods 1.9.3 anymore (because of Hermes afaik), simply downgrading to 1.9.3 is not, and never was a solution.
Has anyone found any information on what might be causing this?
@mrousavy Expo 40 is not compatible with Cocapods 1.9.3. Downgrading to 1.9.3 was a quick patch.
This bug needs to be addressed for sure
Same issue here. I was not able to get a successful archive with Cocoapods 1.10. I had to downgrade to 1.9.3 to get a working archive.
You can try the workarounds explained in the linked cocoapods issues I posted in https://github.com/react-native-mapbox-gl/maps/issues/1097#issuecomment-770071623 if you want to use cocoapods 1.10
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, usebundle exec pod install
.
Spent a good two days on this issue after an accidental computer restart triggered an Xcode update...I have tried everything, thank you!!!
I was able to workaround this issue by forcing cocapods to use frameworks but only for the MapboxMobileEvents pod. This way I can still use static linking for other pods while fixing this and using cocoapods@1.10.1.
In my app Podfile:
pre_install do |installer|
fix_mapbox_events(installer)
end
def fix_mapbox_events(installer)
installer.pod_targets.each do |pod|
if pod.name == 'MapboxMobileEvents'
def pod.build_type;
Pod::BuildType.dynamic_framework
end
end
end
end
Then update pods without the static linking fix:
REACT_NATIVE_MAPBOX_GL_USE_FRAMEWORKS=1 pod update
Awesome! That did the trick for me @janicduplessis. Thanks so much, this has been a thorn in my side.
Added the env-variable in our Podfile too: https://github.com/AtB-AS/mittatb-app/pull/935/files#diff-281ded35b124f5160d0a57e47e521ee6f49f233933e091a0d33f3fd42a74abc8R6 (so my team doesn't have to remember to set it locally / on CI).
Another issue I faced after was that pod update
also broke our build because of a libevent
conflict with Flipper. So a general pod update
might trigger the same for others? Just pod install
so it doesn't update all Pods worked for me ππ» Though I see you've noticed that too: https://github.com/facebook/flipper/issues/1916
While this did fix our issue running the app locally using XCode, we find that during Archiving for the App Store that the MapboxMobileEvents.framework is missing from the .app folder. So the archive is created successfully, but crashes with a runtime error, since it cannot load the framework.
Is anyone else still facing this issue?
@anicol-weatherbug
In your app target > Build Phases
tab > [CP] Embed Pods Frameworks
step, do you have ${BUILT_PRODUCTS_DIR}/MapboxMobileEvents/MapboxMobileEvents.framework
in your Input Files
list?
@naftalibeder
I do not see the inclusion of MapboxMobileEvents.framework
in the Embed Pods Frameworks
build step.
Podfile includes:
ENV['REACT_NATIVE_MAPBOX_GL_USE_FRAMEWORKS'] = '1'
$ReactNativeMapboxGLIOSVersion = '~> 6.3.3'
@anicol-weatherbug If you go in xcode in the Pods project do you see MapboxMobileEvents as a framework? It will have this icon instead.
@janicduplessis For some reason it is still building as a static library, as I seelibMapboxMobileEvents.a
.
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
/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
Versions
Possible reason & Workaround
$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!$ReactNativeMapboxGLIOSVersion = '~> 5.8'
into the Podfile, andpod install
.