Parse SDK / CocoaPods - ios

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.

Related

How do I remove Cocoapod pods from a Flutter project?

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.

Install native iOS pod in flutter

I am facing an error while making a flutter plugin on the iOS side while using pods. The pods are installed successfully then also I am able to import them in the file.
The pod in my case which I am trying to use is Freshchat iOS SDK
Steps I have followed to install the pod
Start a new Flutter plugin project.
In .podspec file add s.dependency 'FreshchatSDK'
Run pod install in example/ios folder.
I got an error
The 'Pods-Runner' target has transitive dependencies that include statically linked binaries: (/Users/nimish/FlutterProjects/freshchat_flutter/freshchat_flutter/example/ios/Pods/FreshchatSDK/FreshchatSDK/libFDFreshchatSDK.a)
I removed use_frameworks! from podfile following this comment .
I ran pod install again and the pods were successfully installed and Pods folder was created which had FreshchatSDK folder in it.
Now I need to have use_frameworks! in my project because other plugins are not compiling because of this.
I added s.static_framework = true in .podspec and use_frameworks! in podfile. Now pod install ran successfully,
After I added the import #import "FreshchatSDK.h" in my Plugin.h file I got the error
error: include of non-modular header inside framework module
I tried this answer but was not able to resolve it.
Please help me resolve this. I'll be respectful of your time.
There is another flutter plugin available here but it has many issues and one unhandled case is making my iOS app crash so I want to make it my own.
There may be problems in the PodFile due to unmatched Targets.
When this happens to me, I used these simple steps.
Delete Podfile
Open Terminal at the specific file
Pod init
Open Podfile and adds Dependencies
Pod install

Issue with Cocoapod, macOS High Sierra and Firebase dependencies

Here is my issue, I recently updated to macOS High Sierra and Xcode 9.1.
I also installed cocoa pods. Then, I have a project, an IOS app which uses Firebase realtime database and Firebase storage.
So, I follow the guide provided by Firebase step by step but I always end with this issue when I try to build my project :
GTMSessionFetcher.framework: No such file or directory
or
GoogleToolboxForMac.framework : No such file or directory
I already read several similar posts on stackOverflow and I try different solutions provided but nothing works...
I tried :
Clean the project
Open .xworkspace
Uninstall/Reinstall pods
Delete Derived Data
Close/Open workspace
Restart Mac
Here is my pod file :
# Uncomment the next line to define a global platform for your project
platform :ios, '11.1'
target 'Jack\'n\'Ferdi' do
use_frameworks!
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Storage'
end
Pods are installed without errors when I launch pod install into the command line. I also try pod update. I am kind of desperate...
Update
When I create a new project from scratch and add those pods, it works perfectly ! The initial project is not from scratch. I got it from Github.

Swift iOS project won't compile if I add any CocoaPod library

I'm new to iOS and am working on an app in Swift. I'd like to use CocoaPods for dependency management, but I am having issues. I've been able to install CocoaPods on my Mac, run pod init to create my pod file, and run pod install to install dependencies just fine. The .xcworkspace file was installed and I've been using it with my project.
My problem comes where after I add any pods to my pod file and run pod install, then go to build my app, there are errors with the pod files that get installed and the project wont build. I've tried a lot of different pods and all have similar errors. My guess is that the errors are related to the Swift version, but I'm not familiar enough with the tools to know how to adjust it.
The project will build fine if I remove the pods from the podfile and run a pod install again.
The errors are all over the files and are things like:
Expected declaration
Consecutive declarations on a line must be separated by ';'
Expected '{' after operator name in operator declaration
My environment specs
pod --version = 1.1.1
XCode Version = 8.2 beta (although I'm seeing the same issues on 8.1)
My podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'MySampleApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MySampleApp
pod 'Marshal', '~> 1.0'
pod 'FontAwesomeKit', '~> 2.2'
end
Also, the app I'm using is the starter sample app from AWS Mobile Hub. Everything works fine until I add a pod.
Any help would be much appreciated. I just don't know where to go from here.
I've found my problem. The Marshal library I was trying to use was not Swift 2.3 compatible (it was build for Swift 3). The AWS Mobile Hub sample app was using Swift 2.3, so I couldn't compile the two together. I decided to use a different library to parse JSON (pod 'SwiftyJSON', '2.4.0') and my app is building fine.

Using CocoaPods for the "Charts" framework. Swift 2

I am a newbie when it comes to CocoaPods so please bear with me!
I am looking at the tutorial (https://www.raywenderlich.com/97014/use-cocoapods-with-swift) however this is using the dependency "pod 'Alamofire', '2.0.2'". I have looked online for over a hour now and I can't find what to use for the Charts framework (https://cocoapods.org/?q=charts).
So Far i have done the following steps:
1.
sudo gem install cocoapods
and got the following output:
2.
pod setup --verbose
and got the following output:
3.
open -a Xcode Podfile
and got the following result :
4.
Uncommented "use_frameworks!" and uncommented "platform :ios, '6.0'" and changed it to "platform :ios, '9.0'"
Now i am stuck as i don't know what dependancies i need to use for the charts framework. Apologies if this is a very simple answer!
Thanks in advanced for your help :)
EDIT: After installing the pod files i dragged the 'Charts.xcodeproj file into my project.
When i try and embed binaries i have various options:
When i add them and build i get the following errors:
Hey First you have to decide which chart library You want to use.
Something like this https://github.com/danielgindi/ios-charts
for above chart library you have to use
pod 'Charts'
in your pod file inside the project .
Now your pod file will be something like this
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Charts'
Now open the terminal and go to your project directory and enter the command
pod install
and you are good to go.
Hope this help you.
Usually there are instructions on what CocoaPod name to use for installation on the GitHub or source code hosting page of the library.
After a pod install command under your correct project directory, you need to exit out of your .xcodeproject and open up the workspace file. This is what you do from now on after a project has a cocoapod dependency. The workspace now contains both your project, and the pods project as a package manager. The pod(s) you installed are there, and must be accessed by importing the name of the CocoaPod (can be seen in folder drop down view in the Pods project).
You do not need to drag anymore files in your own project or embed like before. Make sure to delete those.
If you're still having trouble, can you edit what your current podfile looks like?

Resources