How do I remove Cocoapod pods from a Flutter project? - ios

I have a Flutter app that runs fine on Android devices. It has a Firebase Firestore backend.
Now, I want to build it on an iOS simulator, and so I need to initialize the Firebase iOS app. (I had only initialized the Android version before.) So I tried following the steps on firebase.com for setting up the iOS Firebase app using Cocoapods... but I think I did something wrong! More specifically, I believe the steps I followed were for adding Firebase to a native iOS app (in Objective C or similar), but when using Flutter, I'm supposed to let the Flutter framework do most of this work, rather than adding pods manually! (Here's a specific instruction for adding Firebase to a Flutter iOS project)
But before doing it right, I want to remove the pods that Cocoapods installed for me. Only I don't know how! 😣 When I web-search, I'm told to delete the pods I don't want from the Podfile. Only there ARE no pods in my ios/Podfile! There's only a bit that says:
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
There's also an ios/Podfile.lock file, and THAT one has a list of all the pods... And then, there's an ios/Pods/Manifest.lock file, which also has such a list... So should I delete the unwanted pod names from one of these two files, instead?
Or otherwise, how do I uninstall my Cocoapods pods, when they are not listed in the ios/Podfile?

Turns out the correct way to install and remove pods from a Flutter project is just to edit the pubspec.yaml file in the root directory!
Cocoapods needs to be installed, but it will automatically read the pubspec.yaml file and do the work from there! 🙂 No need to run pod commands from terminal or otherwise.

I suppose you followed these steps? in this case, you don't need to remove pods.
For step 1, step 2, it should be fine.
For step 3, just remove the config file.
For step 4, if you added firebase with swift package manager, remove it from your packages.
I'm supposed to let the Flutter framework do most of this work, rather than adding pods manually!
How did you add pods manually? from your Podfile, I didn't see any new added pods.
Or otherwise, how do I uninstall my Cocoapods pods, when they are not listed in the ios/Podfile?
You don't need to do anything, in worst cases, just remove the Podfile and re-run the app to let flutter regenerate it.

Related

Can't add Mapbox and MapboxNavigation SDK

In order to implement Mapbox SDK, according to official docs (https://docs.mapbox.com/ios/maps/overview/#install-the-maps-sdk,
https://docs.mapbox.com/ios/navigation/overview/), adding Mapbox-iOS-SDK and MapboxNavigation through Cocoapods, always get error, shown bellow.
I thought this is related to the usage of sourcery or SwiftGen which are the parts of project or something else, but this happened on new, clean project also, where inserting SDKs was the first step.
Cleaned derived data for few times,
remove from Podfile versioning for that SDK (pod 'Mapbox-iOS-SDK', '~> 6.0.0' as pod 'Mapbox-iOS-SDK' )
even when SDK is added through CocoaPods, can't find frameworks to add into Link Binary With Libraries
even it says Copy Bundle Resources to be checked, couldn't find what to expect there
Note:
Also tried: successfully added Mapbox and MapboxMobileEvents directly into project, but as I found MapboxNavigation SDK could be implemented only through CocoaPods or Carthage, so I'm stuck here.
I would really appreciate for someone's help, who already have faced this problem.
Multiple commands produce '/Users/x/Library/Developer/Xcode/DerivedData/mbNavigationExample-ctztmwiegsuqkigkucoydhnnoaxc/Build/Products/Debug-iphoneos/mbNavigationExample.app/Assets.car':
1) Target 'mbNavigationExample' (project 'mbNavigationExample') has compile command with input '/Users/x/Desktop/mbNavigationExample/mbNavigationExample/Assets.xcassets'
2) That command depends on command in Target 'mbNavigationExample' (project 'mbNavigationExample'): script phase “[CP] Copy Pods Resources”

Firebase iOS stuck at 'Run your app to verify installation'

React Native Firebase installation for iOS gets held up at the "Run your app to verify installation" screen.
React Native Firebase has worked on Android for me before.
I followed these instructions.
https://rnfirebase.io/docs/v5.x.x/installation/ios
https://firebase.google.com/docs/ios/setup#add_the_sdk
Here are what I've done so far.
-Set up a project within Firebase.google.com page.
-Create an iOS app there.
-Install react-native-firebase via npm.
-Add GoogleService-Info.plist file to the project within XCode.
-Make changes to ios/[YOUR APP NAME]/AppDelegate.m file.
-Creat a new Podfile (Cocoa pod) and updated it by "pod update" command.
-Add and edited lines to the Podfile per the instruction.
-Run "pod install"
-Run "react-native link react-native-firebase" from the project root.
-Click "Next" button within Firebase console and move on to "Run your app to verify installation" section.
-Run the iOS app on simulator by running "react-native run-ios" command.
The app boots up and functions as normal in the simulator.
Nothing happens in the Firebase page.
This is the first couple of lines of my Podfile.
# Uncomment the next line to define a global platform for your
project
platform :ios, '9.0'
# Required by RNFirebase
pod 'Firebase/Core', '~> 5.20.1'
target 'My_App_Name' do
https://dev-yakuza.github.io/en/react-native/react-native-firebase-admob/
Check this guy's blog. In his particular case, he is integrating Firebase and Admob, but the first part is really descriptive on how to install and set the RNFirebase package.
I found the partial answer to this thanks to #Mike Hardy in the other thread here:
Error message - RNFirebase core module was not found natively on iOS
For the most part, you can trust the official instruction on this page.
https://rnfirebase.io/docs/v5.x.x/installation/initial-setup 
However. There are a few things that are not articulated there you’d need to follow in order to install React Native Firebase on iOS.
I followed the below steps and I managed to get it through the infinite “Verify installation” loop.
-1) Comment out the following lines from your Podfile. You might see the same line in two locations. Comment out all of them.
use_frameworks!
-2) Also comment out a couple of lines just BEFORE the very last end in your Podfile. Once you’ve done this, you will only see one instance of end at the last line.
target ‘YourProjectName-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
-3) Insert the following line just before the final end.
system("mkdir -p Pods/Headers/Public/FirebaseCore && cp Pods/FirebaseCore/Firebase/Core/Public/* Pods/Headers/Public/FirebaseCore/")
-4) And then, run pod install and pod update from your terminal.
-5) Go to Xcode, Check the Build Phases/ Link Binary with Libraries section. Confirm that libRNFirebase.a is already there.
-6) Go to Xcode, select a device of your choice and hit “Run”*
*If you use the command from terminal, it will no longer open your app in the simulator. I don’t know why. But it looks as if once React Native Firebase is installed, the only way to test your app is through the Xcode.
react-native run-ios
**Please note I’ve only verified it with the ‘Firebase/Core’ pod. When I tried to add ‘Analytics’ or ‘AdMob’ module in the Podfile, it crashed.
The problem for me was that my GoogleService-Info.plist was actually from a different firebase project, so it had the wrong project id, bundle id, etc.
FOR REACT NATIVE
So I had the same problem and silly me I put the GoogleService-Info.plist file in the wrong place...
It needs to go directly in the /ios folder!
You need to include necessary modules in your Podfile.
Here is my Podfile
pod 'Firebase/Core', '~> 6.3.0'
pod 'Firebase/Messaging', '~> 6.3.0'
pod 'Firebase/AdMob', '~> 6.3.0'
Note that I had to manually change framework path of GoogleMobileAds with XCode to value $(SRCROOT)/../../../ios/Pods/Google-Mobile-Ads-SDK/Frameworks/GoogleMobileAdsFramework-Current in RNFirebase.xcodeproj file in Librairie > Build Settings > Framework Search Paths
I don't know if this works for you but this is what I did.
I backed up my files. created a new project.
Ran pod init and pod install on a fresh project with no code.
After this I closed Xcode and ran $ sudo gem install cocoapods --pre in the same terminal window.
Finally in terminal that I ran pod install and pod update again.
At this point I reopened my fresh project and reconnected my files.Worked like a gem.
I fought with this for probably 12 hours on my new Mac Book Pro.
You probably do not have the latest version of Firebase in your Pods.
Open your Pod file and add this before the "end" statement:
pod 'Firebase/Analytics'
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
Go to Terminal and cd to your root folder of the Xcode project.
Now, type "pod install" and hit enter. This should update your Firebase SDK and build the latest version of Firebase when you build your app.
Note: You should also delete your app on Simulator and re-install it for the changes to take effect.

Issue with import Parse - No such module Parse

I installed the Parse iOS SDK with Cocoapod and wanted to import it in my appDelegate.
But I have the error No such module Parse even if I try to clean the build. Also I have a lot of warning coming from Parse AND Bolt (a dependency).
I downgrade the package from the current 1.15.3 (at the time of this writing) to 1.14.4 but have the same trouble.
here my Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'BookBank' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for BookBank
pod 'Parse'
end
Any idea ?
Edit
I think I found out why. Even opening the *.xcworkspace file XCode didn't seem to link with the Cocoapod libraries. I try with Alamofire or other well known package and I had the same issue. So it was pointing out it wasn't a library problem.
I google for a day (and lost a day of working) and I solve my issue.
I had to change the scheme of the app like so
Click on the upper-left of XCode on your app's name
Then Manage Schemes
And finally change your app container to the one with the workplace.
Clean the build et voilĂ  !

Xcode is not recognising my pods framework

I have found people with similar problems but not exactly the same.
I am using cocoapods for the first time, and Xcode is not recognising the Pods framework. So to ensure that it wasn't related to some existing XCode configuration, I created a brand new Xcode project (PodsTest), but the problem persists (as you can see below).
My podfile is also deliberately minimal with a single pod included:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'PodsTest' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'SwiftSocket'
# Pods for PodsTest
end
On running pod install everything seems to be in order, the PodTest.xcworkspace is created.
Then in the project target within build phases, within the "link binary with library", the framework appears normally "Pods_PodsTest.framework"
I thought it would be easy to get to the bottom of this using a a brand new Xcode project, and having installed cocoapods for the first it should also be running the latest version and so be in a working state. Have I missed any steps that I need to follow? Or what would anyone suggest to look at? You can assume an untampered with Xcode project settings/configuration.
Make sure the cocoapods framework that you want to install is compatible with your current Xcode version. To solve this, give the version after the pods. Because if you don't give the version, it automatically installed the new version. For example:
pod 'Charts' to pod 'Charts', '~> 3.2.1'
or you can simply update your Xcode.
I think the issue happened because you did not added the SDK correctly.
So please follow the steps.
1.In the project navigator, select your project.
2.Select your target.
3.Select the "Build Phases" tab.
4.Open "Link Binaries With Libraries" expander.
5.Click the + button.
6.Select your framework.
7.(optional) Drag and drop the added framework to the "Frameworks" group.
After performing the above mentioned steps please clean your project and build again.
hop this will work , Thank you

Parse SDK / CocoaPods

I have an objective C iOS app using the Parse SDK.
In the process of moving this app from Parse.com to a self hosted Parse-Server, I need to update the Parse SDK to the latest version. For this update I decided to go with CocoaPods.
This is the first time I touch CocoaPods (after reading and hearing so much good about it).
I found my way, following what I could read here and also based on a few CocoaPods tutorial I quickly viewed.
Having my project "ready", when buiding it I get this error:
#import <ParseUI/ParseUI.h> -----> File not found.
Obviously things have changed place. And I tried a couple of unsuccessful solutions.
So here is my question:
How do I need to change the settings of my project, now that I am using CocoaPods?
In order to use Cocoapods with parse and Parse UI you need to do the following steps:
Create a new file and name it Podfile. This file should be located on your IOS project root folder.
The Podfile should contain at least the following structure if you want to use parse IOS SDK and ParseUI
platform :ios, '8.0'
use_frameworks!
pod 'Parse'
pod 'ParseUI'
# Put more pods in here..
Notice to the platform, you may change it to the minimum version that your app can run on and the use_frameworks! will install all your pod as frameworks and this is mandatory if you like to consume Swift libraries.
Open terminal and navigate to your IOS root directory and enter pod install. This command will install all the pods and dependencies into your project.
After installing you will no longer use the IOS project file from now on you will use a new file which called workspace. The workspace will contain both your project files and the pods project/frameworks files.
Build your project, fix some error (if there are) and run it to make sure that it works as expected .
More CocoaPods commands that you need to know are:
pod update - update all your pods to the latest release or to the release that was mentioned in the Podfile
pod update update specific pod to the latest release or to the release that was mentioned in the Podfile
pod outdated - display out to date pods that are being used inside your project.

Resources