To add a new pod into an app with existing pod files - cocoapods

I have an app that that I made about 4 months ago which uses pods. This is the first app I ever used pods for. Now I am updating the app and have another pod I wish to implement in the app. I go into the pod file and add the line pod 1234. then in the terminal do I run a pod install or a pod update?
Read some doc on it but still not 100% clear as I am new to the concepts of pods.

pod install to install the new pod and keep the other pods at the previously installed version.
pod update to install the new pod and update the previously installed pods to their latest versions.
Full details here.

Related

OneSignal.h' file not found Xcode OneSignal 3.5.0

please help me, i try to upgrade onesignal_flutter : ^3.5.0
Issue Xcode :OneSignal/OneSignal.h file not found
Note :
Flutter version 2.10.5
OneSignal_flutter : ^3.5.0
Pod Version 1.8.4
Xcode version 13.2.1
Step to reproduce :
-.https://documentation.onesignal.com/docs/flutter-sdk-setup
Pod deintegrate
rm -rf Podfile.lock
flutter clean & flutter pub get
Pod Install
Run XCode, and show issue
Showing All Errors Only
.pub-cache/hosted/pub.dartlang.org/onesignal_flutter-3.5.0/ios/Classes/OneSignalPlugin.h:29:9: 'OneSignal/OneSignal.h' file not found
Please Help me Guys, Thank u
Step to reproduce :
-.https://documentation.onesignal.com/docs/flutter-sdk-setup
Pod deintegrate
rm -rf Podfile.lock
flutter clean & flutter pub get
Pod Install
Run XCode, and show issue

React-Native Error + Bug in Ruby Interpreter: Failed to install CocoaPods dependencies for iOS project, which is required by this template

I am very new to Apple and app programming so please forgive me if I am not asking my questions in the perfect "format" that you might be expecting...
I bought my MacBook Air running on M1 chip just few days ago and would like to program with Xcode and React Native. As I do the common command "npx react-native init AwesomeProject" I got into the error which I saw quite some other people also run into:
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
I tried all of the suggestions available on other posts (assuming I am understanding the remedies correctly and making the changes accordingly) but none seem to work for me.
I tried also the default suggested solution which is:
Please try again manually: "cd ./AwesomeProject/ios && pod install".
And I seem to get something different from others, which is:
Analyzing dependencies Fetching podspec for DoubleConversion from
../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec
Fetching podspec for RCT-Folly from
../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec
Fetching podspec for glog from
../node_modules/react-native/third-party-podspecs/glog.podspec
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.1/lib/ffi/library.rb:275: [BUG]
Bus Error at 0x0000000102a08000 ruby 2.6.3p62 (2019-04-16 revision
67580) [universal.arm64e-darwin20]
and then
You may have encountered a bug in the Ruby interpreter or extension
libraries.
Is it something to do with my Ruby interpreter? If yes, what are the commands I could use to solve the issue???
https://github.com/CocoaPods/CocoaPods/issues/10349#issuecomment-849468291
brew install cocoapods
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
In my case, need to restart my terminal before execute pod install. Monterey + M1.
The top answer doesn't work for me on my MBP M1 so I fixed the issue this way :
Make sure you have opened project.xcworkspace and not the project.xcodeproj
Open the workspace file with xcode with clicking on it then go to File -> Workspace Settings ... -> Build System -> Legacy Build System
Select the project file then the Target then go to Build Settings Tab and Search Paths
Double click on Library Search Paths Debug and move the $(inherited) to the bottom of the list
Do the same for the Release .
Then Build Again and you're good to go .
If you still get any errors run these commands in the ios folder of the react native project and do the above steps again and it will build successfully.
rm -rf ~/Library/Developer/Xcode/DerivedData/
pod deintegrate
pod install
If you are facing this issue in Mac Big Sur, reinstalling CommandLineTools can fix this issue.
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

Cocoapods: "No Xcode project found, please specify one!"

Cocoapods is giving me this error message when calling pod init:
[!] No Xcode project found, please specify one
I've...
called sudo gem install cocoapods and waited for it to install
dragged in my project directory folder "Hello" (see images)
called pod init
Here's my desktop:
What my directory folder "Hello looks like (sudo gem install cocoapods has already finished
What happens when I try to initialize the pod.
Why does that happen?
if you are using REACT NATIVE or FLUTTER ,make sure go to ios folder ,then pod init
cd ios
pod init
Just close the XCode and terminal once then restart the Terminal. Make sure you select the path to your project folder only.
After calling cd /Users/YOUR_USER_NAME/Desktop/PROJECT_NAME just call a command ~ls and check if the list of the file contains your PROJECT_NAME.xcodeproj. If this file is available, it means you can now set up pod init. Otherwise, you should navigate to the next level and find your PROJECT_NAME.xcodeproj.
Hope it helps! :)
Make sure that you are in the correct directory where you .xcodeproj is located.
My solution:
Using terminal would still not work, so I just used the official Cocoapods application and it worked fine. Just download it, select new podfile and then your project and you're ready to go!
I had the same issue and the problem was because of the space in the directory name. I could see on the Desktop there was no space in the directory name, but in Finder, there was a space in the name. After closing out of XCode and then renaming the folder to have no spaces the issue was solved and 'pod init' worked fine.
My solution:
called sudo gem install cocoapods and waited for it to install
pod setup
dragged in my project directory folder "Hello"
called pod init
https://www.jianshu.com/p/a3b803457b08
It's working for me.
It's working for me .
first import directory in terminal where your .xcodeproj .
then run pod init
it's showing error ([!] No Xcode project found, please specify one)...then run pod install command .. Again it is showing error ([!] NoPodfile' found in the project directory.)`..
then QUIT terminal .. Open again ...
import directory in terminal again Run command pod init ..
Now working fine.
Rename the projectFolder to 7, Project folder should have the same name as the .xcodeproj file has.
Might as well add my 2 cents. I just installed xcode and react native, following this guide: https://dev.to/rob117/how-to-really-set-up-a-react-native-environment-on-mac-248h
Everything seemed to run as expected at first with react-native run-ios...I copied over some react-native files from another project, got some dependency errors, fixed them with npm install, and then I restarted my MacBook. After I booted up again, I ran react-native run-ios and got errors about not being able to launch the iPhone 6 simulator. I couldn't find a fix, so I decided to determine if it was my code or if it was xcode or what. So I went to my main projects directory and started a new react-native project, referencing the link I posted above. After everything installed, I did react-native run-ios again and boom, everything worked fine.
So then I closed xcode, the simulator and the terminal that runs upon starting react-native. I went back to my first project and ran react-native run-ios. boom it's working again, except this strange error error Could not find the following native modules: RNKeychain, RNVectorIcons. Did you forget to run "pod install" ?. I installed cocoapods via brew the first time around, I tried pod install but it complains about no xcode file or something. I've tried pod init, but it tells me No Xcode project found, please specify one. I ran pod setup, no error...seemed to do nothing? I guess it's working because now my simulator is running again.
Maybe I'll just remove the react-native-keychain and react-native-vectoricons npm packages from my package.json and see if it goes away. I don't really understand what coca pods is or why I need it. I'm thinking maybe you should take some time to update xcode, delete node_modules folder and run npm install again, spin up a new react-native project and if it works close xocde, simulator and the terminal and then try to go run your project again.
If it was working fine before and you didn't update anything outside of node_modules folder, remove and reinstall often works for me.
Good luck
I am using ionic, you need to cd to the directory that contains xcode files like (App.xcodeproj + App.xcworkspace) then apply the command
pod init

new swift 2 project doesn't recognize pods

I use xcode 7.2 and today I finished a project and wanted to open another one. I made a new project an made pod init + pod install for swiftyJson and Alamofire and try to run it. I got 19 errors that the pod is unrecognized but I can see the pods in the project files. I asked a friend to open the project on his computer and it runs. The old projects run 100% fine.
How to solve this?
Maybe check your CocoaPods installed version with pod --version. 1.0.0 was released today and may help! I was running into issues with MagicalRecord on the 1.0.0 pre releases yesterday and had to uninstall and then sudo gem install cocoapods -v 0.39.0.
Also, I'm covering some CocoaPods topics here in the near future.

Can't run sudo pod install after updating to cocoapods 0.32.1 with error "You cannot run CocoaPods as root. (CLAide::Help)"

I found an issue when running sudo pod install command after updating it to latest version 0.32.1. Earlier it was working very fine.
When I tried to do pod install with older cocoapods, it asked me to update to latest cocoapods version i.e. 0.32.1. After I updated by cocoapods gem, I can't do sudo pod install in my Xcode project. It gives me following error.
± sudo pod install ruby-1.9.3-p0
Password:
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/gems/1.9.1/gems/claide-0.5.0/lib/claide/command.rb:328:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)
CocoaPods, the Objective-C library package manager.
Commands:....
Any suggestion to overcome the issue would be very helpful. Thanks in advance.
I had to update permission on CocoaPods
sudo chown -R $USER ~/Library/Caches/CocoaPods
sudo chown -R $USER ~/.cocoapods
Since it seems to fix the problem for some people, you might want to try running "pod install" and see if it fixed your problem from that point. However, I still had a permission denied when running "pod install" for a pod item, so running the next line will overwrite permission for the pod folder.
sudo chown -R $USER ./Pods
I have removed the old podfile.lock before running pod install
Source :
cocoaPods pod install Permission denied
https://github.com/CocoaPods/CocoaPods/issues/509
I am working with windows. After reading all tips which didn't work I drove into the code base.
As a disclaimer, I am beginning phase of developing an app and my goal is to get a quick proof of concept. Therefore, this solution will only bypass that the error message as a quick hack.
In the file ~/lib/cocoapods/command.rb you will find a function on line 47 that stops the program if there is a root user.
#help! 'You cannot run CocoaPods as root.' if Process.uid == 0
Simply comment out the line. Again, this is a terrible idea to do in any situation except as a pragmatist using Windows and trying to get proof of concept out.
Nothing worked for me except the following
switched to ios platform with cd platforms/ios
switched ownership of the folder to the current user with sudo chown -R YourUsername .
Pod install
In m1 MACs run sudo arch -x86_64 pod install --allow-root to resolve this issue.
in my case, the both "folder content project" and file "project.xcodeproj" was locked "i ignore why !!! maybe the git clone provoked error :s", i unlock the folder and apply all changes for sub folder .... And it WORK FINE :D

Resources