I already have a podsfile importing several other projects as frameworks, which works pretty nicely. Unfortunately it is not possible to install the gcm ios library as a framework. What is the way to go here? Just drag and drog the gcm pod into the project?
There's a setup guide for both objective-c and swift on the developers site of gcm, it can be found here - https://developers.google.com/cloud-messaging/ios/client?ver=swift
pod init
Open the Podfile created for your application and add the following:
pod 'Google/CloudMessaging'
Save the file and run:
pod install
This creates an .xcworkspace file for your application. Use this file for all future development on your application.
Related
I want to share framework in another app. I am facing issues when I have some libraries/pods like Alamofire in my framework. what is the solution of this problem? how can i use that library in framework? Also i tried to install Alamofire pod in to the other app in which i have added framework, and tried to access in my framework class but this was not accessible. please guide me how to do it. Thank you
You can use Cocoapods to achieve that. Basically, cocoapods will create a framework for you from the source files that you define and will also install the appropriate dependencies that you define in the target project when the target project does pod install.
Apart from cocoapods, you can also use Carthage which is also a dependency management tool.
You can read more about cocoapods here and how to create a new pod here
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.
I was trying to add cocoapods for admob firebase in my iOS app. But pod intsall command took too much time. Now i want to add firebase admob directly without cocoapods.
I have downloaded whole SDK from https://dl.google.com/firebase/sdk/ios/3_5_2/Firebase.zip .
It shows several folder with like AdMob Analytics, AppIndexing, Auth,Crash, Database,DynamicLinks, Invites, Messaging, RemoteConfig, Storage.
For cocoapods, we see they import firebase in .h file and add [Firebase configure] method.
What for SDK? Do I need to use only AdMob folder here? do I need to use the whole SDK? How would it need to be implemented?
Finally, i figured it out. import firebase is not working anymore. Hope the documentation is not updated properly.
Anyone should directly integrate Firebase to your project. And the documentation is not updated still. There is a issue there. Follow steps for analytics, add your database parameter from the video.
https://www.youtube.com/watch?v=joVi3thZOqc
https://www.youtube.com/watch?v=XIQsQ2injLo
Firebase and Admob for recommend to use cocoapods.
This contains 4 separate steps:
-Link with firebase
-Download GoogleService-Info.plist
– Update cocoapods
– init Firebase in app.
Link with Firebase:
This is just creating a connection Firebase with Admob app. From the console top right menu, there is a button to connection with firebase.
Console link : https://console.firebase.google.com/?pli=1
Download plist file :
It’s free and just takes a few minutes. When asked for a Bundle ID, enter the Bundle ID from the project you want to use for testing.
Once you have a GoogleService-Info.plist file, save it in the same directory as the rest of the XCODE project source.
Update cocoapods and install pod:
Now go to project directory from command terminal.
Run this command, this will install cocoapods
sudo gem install cocoapods
When cocoapods installation is complete, start adding to your projects with this command.
pod init
This command will create pod file in projects directory. You can add the rest command from terminal but also can be done by opening the file directly. I have done it for admob my project.
source ‘https://github.com/CocoaPods/Specs.git’
# platform :ios, ‘7.0’
pod 'Firebase', '>= 2.5.0'
target 'projectname' do
pod ‘Firebase/Core’
pod ‘Firebase/AdMob’
pod ‘Firebase/Database’
end
Save the file and go to command line again. Now run any of this two command.
pod install
OR
pod install –verbose
Second one worked for me. I got some bad file issue with first command. This may take more than 2 hours for the first time.
Got solution from this link : cocoapods - 'pod install' takes forever
When this complete, you will get some yellow line that firebase , admob and other necessary framework successfully added to your projects with cocopods.
Init FireBase (Most important step *** ) :
Google changes their framework but did not updated their documentation because the way is not working currently.
You may get some issues still:
Check you project settings -> Other Linker Option and set it $(inherited).
And Don’t forget to set Build architecture YES
Now you have to import Firbase and work for configuring it.
#import Firebase, this line is not working anymore.
So you have, import this like :
#import <Firebase/Firebase.h>
Now configure you Firebase in didFinishLaunchingWithOptions method using
[FIRApp configure];
This is for analytics. To init Database, follow this link:
Where to add Firebase Database Reference in iOS Obj-C
iOS : Objective-C : Firebase : Is it possible to read the cached data first for any reference?
CLEAN, BUILD AND RUN. Hope everything should works fine. You will see few line in your logs that Firebase has been started configuring projects. Happy Developing !!
I am pretty new to swift and iOS development. I am trying to write a framework using swift 2.0. I need to import the CocoasMQTT library in my framework. I am using cocoa pods approach for this and i added
use_frameworks!
pod 'CocoaMQTT'
in my pod file. After this I pod install. Now in my Pods directory I can only see debug.xconfig and release.xconfig files(in xcode directory view). I think this should have worked but I am unable to import the library in my swift classes as it says that "No Such module 'CocoaMQTT'" when i try
import CocoaMQTT
in my code.
Can anyone explain if I am doing something wrong. P.S., as I have included use_frameworks! and I am using iOS version 9 for development so I think I don't have to write the Objective C bridge header.
I had same problem to. My problem cause about using CocoaPods. I think you open .xcodeproj file by Xcode but if you install pods you must open .xcworkspacefile. You should look raywenderlich's forum for using cocoapods.
https://www.raywenderlich.com/97014/use-cocoapods-with-swift
Close your xcode after pod install, and open the .xcworkspace file generated by Cocoapods.
Is there a way to get the Google Cloud Messaging framework without using Cocoapods? I use Carthage and don't want to have to use cocoapods just for this one library.
If you use on a demo project the pod and you put this on your PodFile
target 'MyTarget' do
use_frameworks!
pod Firebase
end
Then pod install and below Pods target you will get a .framework which you can use on your real project without using cocoapods.
It's awful to update the framework, because you need a demo project but better than nothing.
Hope it helps