OK, apologies if this may come across as a 'green' question ...
I have incorporated the Google AdMob SDK via CocoaPods successfully.
My pod file looks like:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
pod 'Google-Mobile-Ads-SDK', '~> 7.0'
So my Podfile should automatically 'grab' any version 'newer' than version 7.0.
I am still developing my app, and when I run tests on my physical device, I am presented with this type of message in the console:
You are currently using version 7.8.0 of the SDK. Please
consider updating your SDK to the most recent SDK version to get the
latest features and bug fixes. The latest SDK can be downloaded from
....
So I run Podinstall command via the terminal targeting my relevant directory that holds my development app's latest Xcode project, and it updates all relevant Google Mobile Ad SDKs to the current version.
I guess while my app is not 'live', my Podfile is essentially inactive in terms of updating itself automatically.
Question : If I were to upload my project today to the App Store with my Podfile updated to the most current Google AdMob SDK version, will it automatically update my project to the most current version thereafter? Are the three (3) lines of code in my Podfile sufficient?
Many thanks and apologies in advance if this is an extremely basic question ;)
I am fairly new to CocoaPods myself so I am not 100% what you mean with
"I guess while my app is not 'live', my Podfile is essentially inactive in terms of updating itself automatically."
I believe to update your Pods you need to run the Update command, it does not update itself automatically.
If I were to upload my project today to the App Store with my Podfile updated to the most current Google AdMob SDK version, will it automatically update my project to the most current version thereafter?
I believe no, you need to run podUpdate.
Are the three (3) lines of code in my Podfile sufficient?
Should be
This is how my pod files looks
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'MyGame (iOS)' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Google-Mobile-Ads-SDK', '~> 7.0'
pod 'ChartboostSDK'
# Pods for MyGame (iOS)
target 'MyGame (iOS) Tests' do
inherit! :search_paths
# Pods for testing
end
end
CocoaPods actually released an app for OSX recently, which makes using it a lot easier
https://cocoapods.org/app
To read more update pod updates vs installs you should read this.
https://guides.cocoapods.org/using/pod-install-vs-update.html
Or a great swift tutorial from ray wenderlich
https://www.raywenderlich.com/97014/use-cocoapods-with-swift
Hope this helps
Related
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.
I am using Cocoapods to manage my Admob/Google ad-related frameworks.
My pod file is as follows:
target 'SKGameTest' do
use_frameworks!
pod 'Firebase/Core'
pod 'Firebase/AdMob'
pod 'Google-Mobile-Ads-SDK'
end
I have updated Firebase and Google-Mobile-Ads-SDK using the Cocoapods app. Now that these frameworks have been updated, will all current versions of my app use these latest frameworks? Or will my app users have to download a new update containing these updated frameworks? If the last option (downloading a new update for the app) is true, then this would be really annoying as you would have to release a new update for your app each time Google updates their SDKs.
Please explain to me about how this all works, thank you.
I have gone through some testing and have discovered that updating Cocoapods will not update all versions of the app (unfortunately). When updating your SDKs you will need to release a new version with it.
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.
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'm following this tutorial to put Google Ad on my page: https://firebase.google.com/docs/admob/ios/quick-start
At the step:
GADMobileAds.configureWithApplicationID("ca-app-pub-8123415297019784~8909888406");
And the error occurred:
AppDelegate.swift:58:9: Type 'GADMobileAds' has no member 'configureWithApplicationID'
And after the checking, i see there is no member configureWithApplicationID.
What's wrong with this instruction?
And why i have to install Firebase/Core in this version?
Here are methods in GADMobileAds, there is no configureWithApplicationID like Objective C version. How stupid is that http://i.imgur.com/Od0vkPg.png
Remove the cocoapods line from the instruction and replace with this line:
pod 'Google-Mobile-Ads-SDK'
It will install the google sdk version 7.9.0 and you'll see the configureWithApplicationID method. This is the error from Google for Swift.
Xcode 7.3, iOS9.3.3
Followed the instructions above, but wanted to expand, in hopes of saving someone time. If you had 'Google-Mobile-Ads-SDK' pod already installed, then check the version to make sure it is 7.9.0+. Otherwise, you will keep installing the old version over and over.
To update the version, follow the instruction taken from Cocoapods website https://cocoapods.org/pods/Google-Mobile-Ads-SDK click "Installation Guide" (bottom right):
The '~> 7.9' bit will force an update.
What I had that did not work:
What it needs to be:
Again, note the version is 7.9.1
The Podfile looks like this:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'AppName' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for AppName
pod 'Firebase'
pod 'Google-Mobile-Ads-SDK', '~> 7.9'
target 'AppNameTests' do
inherit! :search_paths
# Pods for testing
end
end
Now you will be able to configure GADMobileAds with the Google prescribed method:
[GADMobileAds configureWithApplicationID:#""];
Or the Swift equivalent:
GADMobileAds.configureWithApplicationID("");
Hope this helps! Cheers.
Try to update Podfile to the following:
#pod 'Firebase/AdMob'
pod 'Google-Mobile-Ads-SDK'
I recently tried to update my pod to pod 'Google-Mobile-Ads-SDK', '~> 7.9' and it did not work for me. Because I already had a version of Google-Mobile-Ads-SDK in my file, I simply needed to run pod update. The problem was that Google has updated the SDK beyond 7.9 and updating versus naming a specific version ensures you get the latest one.
The instructions in the Google documentation are ok. I was running into the same issue with CocoaPods installing the old version. Use the Cocoa Pods update command and it fetches the latest version of Admob and the error goes away.
I see it right here in GADMobileAds.h. Check to see if you have the most up to date version.
//
// GADMobileAds.h
// Google Mobile Ads SDK
//
// Copyright 2015 Google Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#interface GADMobileAds : NSObject
/// Returns the shared GADMobileAds instance.
+ (GADMobileAds *)sharedInstance;
/// Configures the SDK using the settings associated with the given application ID.
+ (void)configureWithApplicationID:(NSString *)applicationID;