Xcode builds successfully a corrupted archive, not showing in organizer, as soon as cocoapods installs react-native-mapbox-gl from Podfile - react-native

The problem seems not new, as here, but the solutions proposed didn't work.
I tried also several other approaches to understand what's going on (see here).
To replicate, this is the process:
I have a working iOS App written in Swift.
I follow the description to integrate this app with Native React this procedure
I add to the package.json the following dependencies, and run yarn install:
"#react-native-mapbox-gl/maps":"^8.1.0-rc.9",
"prop-types": "^15.6.2",
I run pod install --repo-update and Archive on Xcode.
OUTPUT: At this point the organizer displays my Archive.
I implement a basic view on mapbox following this procedure
I add to the Podfile requiring use_framework!, as described here or after use_framework!, no difference in the result after I hit pod install --repo-update.
I hit Archive on Xcode.
OUTPUT: the archive is generated successfully, but doesn't show up on the organizer. If I try to open it, the archive is corrupted.
If I remove the pod file of mapbox and I Archive the project after hitting pod install --repo-update, the archive works and shows up in the organizer. Here the same description.
The project runs both as debug and release on a real iPhone 8. Mapbox works well. However, it doesn't work on simulator, nor archive. I can leave with the former, but I can't push on App store because of the latter.
I would not give up as Mapbox is very nice and provides lots of features. What could it be?

SOLUTION :
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.9.3
rm Podfile.lock
rm -rf Pods
pod install
LAST MESSAGES :
Same here. Impossible to find any solution.
Xcode is building a incomplete archive file. (By incomplete, I mean that in the archive package, some files are missing, like info.plist)
If this can help, I'm using MapboxGL too.
Edit :
Found this https://github.com/react-native-mapbox-gl/maps/issues/1097#issuecomment-725689831
Edit 2:
This link was the solution !

I got the exact same problem with :
#react-native-mapbox-gl/maps": "8.1.0"
COCOAPODS: 1.10.1
Xcode 12.4
The archive was corrupted (missing parts like the plist)
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...

It looks like mapbox issue. I had the same issue and instead of downgrading the cocoapods I used this solution:
Edit your package.json, set:
"#react-native-mapbox-gl/maps": "^8.2.0-beta1",
2. Run yarn install or npm install.
3. Put the code into your ios/Podfile between pre_install do |installer| and end:
$RNMBGL.pre_install(installer)
And between post_install do |installer| and end:
$RNMBGL.post_install(installer)
Run cd ios && pod install
After these steps I was able to generate to archive.

Related

Why is Expo iOS build failing? ...something with ExpoModulesCore

Hey guys so I have an expo managed app and I want to use a notification library called Notifee which has an expo plugin. This plugin adds native code not supported by Expo Go, so I'm forced to enter bare workflow and build native iOS and Android folders.
I'm building the iOS package by running expo run:ios. And build fails due to something with ExpoModulesCore:
The following build commands failed:
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'ExpoModulesCore' from project
'Pods')
So I did some research and found that others had the same issue here on Stackoverflow. I tried altering the pod file and updating ExpoModulesCore
pod update ExpoModulesCore as this answer suggests
https://stackoverflow.com/a/71104305/8561357
After updating ExpoModulesCore and re-building, I get an additional error:
The following build commands failed:
PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/kevin/Library/Developer/Xcode/DerivedData/Addressbook-gmgtddiltntfosevknuexadcwkpt/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-BC35D93E0A296DC41D8D893483CBC12F.sh (in target 'FBReactNativeSpec' from project 'Pods')
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'ExpoModulesCore' from project 'Pods')
(2 failures)
So why does this happen?
I saw something about Xcode version 13 not working, only 12??
Is Expo version incompatible?
Really trying to figure out what's going on here
maybe its was to late.
if you using react native 0.64.4, add or change expo-module-core version to ^0.6.5 on your package.json.
delete node_modules folder and yarn.lock (if you using yarn)
reinstall node_modules using yarn yarn install
sync node_modules with pod using pod deintegrate and then pod install on ios folder.
install expo modules using npx install-expo-modules from root project.
then build ios using yarn run ios
maybe you need to see similar issue on here:
http://bataxdev.com/blogs/detail/unable-to-find-a-spesification-for-expomodulescore

How to run pod file in iOS directory in react native?

error Could not find "Podfile.lock" at projects\reactNative\ios\Podfile.lock. Did you run "pod install" in iOS directory?
(node:11696) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
error Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues. Run CLI with --verbose flag
Issue 1
For fixing the issue:
Could not find "Podfile.lock" at projects\reactNative\ios\Podfile.lock. Did you run "pod install" in iOS directory?
Please make sure you have install cocoapods and run this command at your project root:
gem install cocoapods // If you haven't install cocoapods
cd ios && pod install && cd ..
Issue 2
For fixing the issue:
(node:11696) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency (Use node --trace-warnings ... to show where the warning was created)
Please downgrade your node.js version to v13.x.x, one of the solutions below:
npm install -g n
sudo n 13.13.0
Issue 3
For fixing the issue:
Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues. Run CLI with --verbose flag
Please make sure you have installed Xcode correctly from App Store and use the latest React Native version in your project (should be v0.62.2 now for stable). If still cannot open the project, please try to add some simulator in Xcode's developer settings.
Cheers!
you did not install cocoapods
install cocoapods commands
sudo gem install cocoapods
after that in react native directory
cd ios && pod install && cd ../ && react-native run-ios
CocoaPods manages library dependencies for your Xcode projects. We need it to setup the iOS project. Like yarn
sudo gem install cocoapods
The Podfile is a specification that describes the dependencies of the targets of one or more Xcode projects. Like package.json
access to the folder with Podfile, run
pod install
This will resolve the code of those dependency framework, and generate Pods.xcodeproj for your iOS project.

Could not find the following native modules after upgrading the react-native to latest version 0.61.4

After upgrading the react-native version I am getting the following. And failed to run the build in simulator
After this, I have run react-native run-ios it shows all my packages are manually linked and you need to unlink all packages.
Also, can anyone clarify the react-native-config.js file is mandatory for this after updating to the latest react-native.
Always I open the app.Xcodeproj but the below shows I need to open app.xcworkspace. Can anyone clarify this?
warn The following packages use deprecated "rnpm" config that will stop working from next release:
- react-native-fetch-blob: https://github.com/wkh237/react-native-fetch-blob#readme
- react-native-orientation: https://github.com/yamill/react-native-orientation#readme
- rn-fetch-blob: https://github.com/joltup/rn-fetch-blob#readme
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
error Could not find the following native modules: BugsnagReactNative, react-native-camera, react-native-cookies, react-native-fast-image, react-native-fetch-blob, RNFS, RNGestureHandler, RNImageCropPicker, react-native-image-picker, RNImageRotate, BVLinearGradient, react-native-orientation, RNShare, RNSVG, RNVectorIcons, RNViewShot, react-native-webview, rn-fetch-blob. Did you forget to run "pod install" ?
info Found Xcode workspace "Fashion.xcworkspace"
This should fix your issue.
rm -rf ios/Pods && rm -rf ios/build && cd ios && pod install && cd ../
rm -rf node_modules && rm yarn.lock && yarn install
PS: In react-native version 0.60 and above, native modules are now auto-linked. See the docs for more: https://facebook.github.io/react-native/blog/2019/07/03/version-60#native-modules-are-now-autolinked
firstly, when you update the react-native version, you should react-native official document. to avoid some wrong things. the details for update in the react-native update helper.
and for your question, since 0.60, CocoaPods are now part of React Native's iOS project. If you weren't already, be sure to open iOS platform code using the xcworkspace file from now on.
At the same time, a react-native link is now not needed in most situations anymore. the react-native team overhauled the linking process in general. Be sure to react-native unlink any preexisting dependencies as mentioned in the docs above.for more details, you can read this article.
for the rnpm problem, firstly you should delete it in the package.json.
then create a react-native.config.js file in project folder.
const ios = require('#react-native-community/cli-platform-ios');
const android = require('#react-native-community/cli-platform-android');
module.exports = {
project: {
ios: {},
android: {},
},
// assets: ['Resources/fonts'], // stays the same
// commands: require('./path-to-commands.js'),
};
then in the rn-fetch-blob(make is as an example), you also create
react-native.config.js and modify it according to its rnpm config
In the latest react-native stable version, you dont need to link the 3rd party libraries, just install it and it will work fine
Firstly,
So, when you are migrating from lower version to higher stable version,
then what you need to do, just unlink all the libraries you have used
in your project as react-native automatically detects its
dependencies. and moreover remember that whenever you install such
libaries you don't need to run the react-native link <library-name>
to link it.
Secondly,
Now you need to work with xcworkspace file as in the latest version,
ios are dealing with pods, and when pods comes into picture then you
have to use xcworkspace instead of Xcodeproj in your ios project
You can check the changelog here for react native 0.61.4 version.
I hope this helps....Thanks :)
My solution is to combine some tips above and update mine Pod file
Simply reset:
rm -rf ios/Pods && rm -rf ios/build
cd ios && pod install && cd ..
rm -rf node_modules && rm yarn.lock && yarn install
Reason is to maximize future compatibility.
Here is a facebook provided template, pick some goodies for your existing old pod file:
https://github.com/facebook/react-native/blob/0.63-stable/template/ios/Podfile
You may found code below is auto linking,
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
You may need to upgrade ios target
platform :ios, '10.0'
You may use Flipper without use_frameworks! enabled
Could be that there is something in your podfile that causes this. For example, I removed a library from my project but there was still a reference to it in the podfile:
pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal'
Once commenting/removing this line, pod install works great.
For me just converting npm install to yarn install worked because other team was using yarn and i was trying to install packages using npm so it created some conflict.
I recloned the project then
'yarn install', 'react-native link' and then
'pod install'

AppCenter doesn't seem to run pod install despite existence of Podfile

I've got a react-native app that builds on AppCenter. I have a Podfile in my /ios directory, and locally, I can run pod install. The AppCenter documentation says that "App Center scans the selected branch and if it finds a Podfile, it will automatically do a pod install step at the beginning of every build. This will ensure that all dependencies are installed.", but as far as I can tell, it's not running pod install for my build and the build fails for that reason.
Tried adding pod install to a pre-build script, in which case the build succeeds.
Make sure the Cocoapods version running on the build agent matches the one on your podfile.lock.
You can add a post clone script like this on your ios/ folder:
appcenter-post-clone.sh This will automatically install the matching cocoapods version.
Push that file to your repo, then make sure you open the build configuration and hit Save and Build.
It appears that in addition to having a Podfile, you must NOT have a ios/Pods folder present. In my case, I also had to explicitly add that folder to my .gitignore

'pod install' doesn't update an existing pod

I am trying to update my pod using pod install and finding that it doesn't update properly unless I delete the original pod.
Is there some extra step required or is there a common mistake that makes updates fail?
I'm not sure from which version, but if you update your cocoapods installation to the latest version, you'll find two new commands to help with this.
pod outdated
This will list all pods that have updates available.
pod update
This will update the pods listed in the previous command
You can add the verbose tag and see if there is an error showing up during the update.
pod install --verbose
Using --verbose is the best way to find out what is going on. Maybe there is a problem with the repo it is trying to update from. Hard to say.
I think reader of this Question must understand difference between
pod install vs. pod update
Many people starting with CocoaPods seems to think that pod install is only used the first time you setup a project using CocoaPods and pod update is used afterwards. But that's not the case at all.
Use pod install to install new pods in your project. Even if you already have a Podfile and ran pod install before; so even if you are just adding/removing pods to a project already using CocoaPods.
Use pod update [PODNAME] only when you want to update specific pod to a newer version.
Use pod update only when you want to update every pod to a newer available version.
Every time the pod install command is run — and downloads and install new pods — it writes the version it has installed, for each pods, in the Podfile.lock file. This file keeps track of the installed version of each pod and locks those versions.
When you run pod install, it only resolves dependencies for pods that are not already listed in the Podfile.lock.
For pods listed in the Podfile.lock, it downloads the explicit version listed in the Podfile.lock without trying to check if a newer version is available
For pods not listed in the Podfile.lock yet, it searches for the version that matches what is described in the Podfile (like in pod 'MyPod', '~>1.2')
If your project is configured correctly, you should be able to delete the entire Pods directory and run pod install. I find that this is sometimes the best solution when having issues with pods not being installed properly.
Note: If you begin getting errors such as this when you build:
diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
... you may need to close and reopen the project in Xcode.
Warning: make sure all the files in your Pods directory are going to be recreated before deleting the Pods directory. (I.e. make sure you didn't manually modify or add files to the Pods directory.)