How to get latest GoogleMaps SDK using pods - ios

I'm trying out the google places sdk sample. I installed it using
pod try GoogleMaps
I installed GoogleMaps (1.10.5) using cocoapods
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
pod 'GoogleMaps'
checking the GoogleMaps in both steps, the one in the sample (1) contains more headers like GMSAutocompleteTableDataSource.h
Why are they different? The one in the sample seems to be a better version but the one given by pods is not the latest? Its not even in the changelog

Run pod update GoogleMaps. Cocoapods won't update the version of a pod you've already downloaded unless you explicitly run pod update or update the podspec to require a newer version. See https://guides.cocoapods.org/using/pod-install-vs-update.html for more details.

I checked the latest podspec
I just need to set the version to the latest
e.g
pod 'GoogleMaps', '~> 2.5.0'

In my project's podfile, I don't specify the version. The pod line just specifies: pod 'GoogleMaps'
So, if you don't include the version in the podfile, then the following command in a Terminal window will update to the latest version: pod 'GoogleMaps'
Please ensure the you are in the correct folder containing your podfile before entering this command.
It may take a while for Pod to process when you see this message: Updating local specs repositories.
Be patient - it took about 20 minutes.

I just ran into this error, and I updated to latest GoogleMaps per the advice above, but had to delete the app on my device and install fresh for it to resolve the error. Error was still present until I did that.

Related

Tons of issues with Alamofire when compiling xcode project

I was running my program softly and at some point (maybe closed the Xcode to reopen or updated pod file) it suddenly it can't compile anymore.
I already tried opening .xcodeproj and .xcworkspace. The first one shows this message when compiling:
The second case shows tons of issues:
This is my pod file:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'HonoluluArt' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
# Pods for HonoluluArt
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 3.0'
pod 'GoogleMaps'
pod 'GooglePlaces'
end
Can I get any help? Thanks a lot!
try to clear pods and reinstall:
in the project folder execute: pod deintegrate
then clean pods: pod clean
Reinstall pods: pod install
this should work
also if you don't need in particular the v3 of Alamofire remove ~> 3 to install the latest version and modify your Podfile:
target 'HonoluluArt' do
use_frameworks!
pod 'Alamofire'
pod 'GoogleMaps'
pod 'GooglePlaces'
end
Alamofire ~> 3.0 is written in Swift 3. Podfile shows that this is an older codebase. You could try building you project with older version of Xcode (xCode 10.0 is last version supporting Swift 3) or you should upgrade Alamofire to actual version ~> 5.0 (you will also need to upgrade project codebase to newer Swift version).
You indicated you opened the project file and compiled. Cocoa Pod instructions clearly state after installing, you should only work in the .xcworkspace file thereafter. Can you open that and try a compile?
I just removed any reference to Alamofire. Pod file, imports, paths and stuff and it worked. I'm trying to manage the code once it is removed, but worked.
Thanks anyway!

Many build errors after pod update

I have many pods installed in my project. Everything worked fine since my last pod update. After last pod update, I have 28 build errors starting with "Could not build module xxx".
Here is my podfile:
target 'projectXXX' do
use_frameworks!
pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
pod 'Firebase/Messaging'
pod 'Firebase/Crash'
pod 'TwitterKit'
pod 'Fabric'
pod 'Crashlytics' end
I tried to uninstall - install cocoapods.
I tried to deintegrate pod from project, install, remove .workspace file and deriveData folder... still got these errors.
I'm running out of ideas. Please, any other solution?
Thanks you very much
EDIT
I have just discovered that my Pods.framework is in red state as visible on screenshot below. Maybe this can help?
First try to remove cocoa pods completely
gem install cocoapods-deintegrate
pod deintegrate
gem install cocoapods-clean
pod clean
Then install again like this
pod setup
open -a Xcode Podfile
In Pod file add like this
# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'TestProject' do
pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
pod 'Firebase/Messaging'
pod 'Firebase/Crash'
pod 'TwitterKit'
pod 'Fabric'
pod 'Crashlytics'
end
target 'ProjectTests' do
end
pod install
Updating Xcode can resolve this issue. Thing is, pods might support multiple swift versions, so pods should be able to specify a range of swift versions.
Before Updating check if PODS_ROOT user-definer value in Build Settings of target is not deleted may be accidently. If so Try to add PODS_ROOT=${SRCROOT}/Pods
It's possible that you use old pods repositories and after update (that was few month ago) you need to specify which pod repository to use. I suggest that you need old one. See how looks my pod file for old project:
source 'https://github.com/CocoaPods/Old-Specs.git'
platform :ios, '9.0'
use_frameworks!
xcodeproj 'SF'
#link_with 'SF'
target 'SF' do
pod 'TransitionKit'
pod 'MBProgressHUD'
pod 'PureLayout'
pod 'UICountingLabel'
pod 'MWPhotoBrowser', :git => 'https://github.com/pash3r/MWPhotoBrowser.git', :branch => 'skyFlyWork'
end
What could cause the issue:
- Breaking changes in Pods/APIs
- Breaking changes due to support/non-support of Swift versions
If you are using a versioning system (Git, etc.).
Retrieve an older version of Podfile.lock.
Read that file (it's a text file, you can do more somePath/Podfile.lock in Terminal.app), and the "explicit" versions of your pods should be there.
You should get something like:
PODS:
- GSKStretchyHeaderView (1.0.3)
- Masonry (1.1.0)
...
PODFILE CHECKSUM: someCheckSum
COCOAPODS: 1.1.1
When you do pod 'Firebase' you don't specify a version, so you should get the last one. But if some versions are not compatible, you can get issues.
So you may add the '~> 1.0.3' (for instance if I take my example of GSKStretchyHeaderView). More informations on how to use it here.
So this way you should get back on a older version when everything was working. Now, you can check the documentation of each pods (and their respective podspec looking for "hidden" dependencies) and update them one by one checking which one is the culprit, and then maybe rising a flag (an issue) on their repo/git if needed.
For next dev, I'd suggest to set "version", to at least majors using the "optimistic operator ~>". If they respect the rules of versions, (major/minor/patch), then at least determine the major/minor, a patch shouldn't break anything, but fix things. A minor may have breaking change, while a major has a lot of probability to not be compatible with previous work (different declaration, classes renames, etc.).
If you don't use a versioning system like Git, I STRONGLY suggest you do now.
But if that's your case and you still have the issue. Remember a date when everything was working fine after a pod update/install. Then, go to each Git of your pods, and read the history to find the version at that date and set that version in your podfile for that pod.
Shen you are doing pod update which update all libraries most of the libraries on swift4 still some of them in swift3
If libraries are in swift 4 and your project in swift 3.2 you have two possibilities
you can migrate project to swift4
(or)
you need to rollback to the swift 3.2 supported pods
If project in swift4 libraries in swift3 you need to migrate those libraries into swift4 to solve current problem

CocoaPods - A custom dynamic framework - cannot get the latest version of frameworks

My project in Xcode consist of static frameworks and one custom dynamic framework. This dynamic framework includes some other static frameworks.
When I try to compile the custom dynamic framework itself, everything is fine. I was able to force to install latest version of frameworks (Alamofire, Realm, etc..) by forcing the pod definition file
platform :ios, '9.0'
But when I compile my project even when I use the above line, I am getting the old frameworks.
When I try to force the pods for a explicit version,
pod 'Alamofire', '~> 4.4.0'
getting the version 3.5.1.
Is there any other explicit setting to force CocoaPods to be more accurate in versions?
Originally the project for the dynamic framework was made for the Swift version 2.3, which is actually requiring the version of Alamofire 3.5.1.
Any help will be appreciated.
Maybe try the following in your podfile:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '4.4.0'
That will bypass your local spec repo and get straight from git.
Which version of CocoaPods you have currently installed on your machine? Which version was used to originally establish Pods in project? I've spotted an issue when I updated CocoaPods, that pod update hasn't been working properly, and removing just Podfile.lock and Pods/ directory wasn't sufficient to make things right.
That said I would do the following:
update CocoaPods to newest version
pod repo update for newest Pod specs
pod deintegrate to completely remove Pods from project
pod install to re-create Pods in the project
The solution is kinda tricky. I haven't realise in the beginning that the pods under a dynamic framework cannot actually be executed directly from top project and there is a configuration JSON file, which actually is managing the pods under the dynamic framework.
So the pod versions were actually hardcoded there.

How to keep changes I did in the Pod dependencies after I do cocoapods install again?

I had to do some local changes to some frameworks I am using. However, I installed them with cocoapods. Is there any way to keep those changes when I do pod install again for new dependencies ?
Thanks for the ask question.
I am sorry to say this is not possible because when you have install or Update your pod then replace all file from new file.
pod outdated:
When you run pod outdated, CocoaPods will list all pods which have newer versions than the ones listed in the Podfile.lock (the versions currently installed for each pod). This means that if you run pod update PODNAME on those pods, they will be updated — as long as the new version still matches the restrictions like pod 'MyPod', '~>x.y' set in your Podfile.
pod update:
When you run pod update PODNAME, CocoaPods will try to find an updated version of the pod PODNAME, without taking into account the version listed in Podfile.lock. It will update the pod to the latest version possible (as long as it matches the version restrictions in your Podfile).
If you run pod update with no pod name, CocoaPods will update every pod listed in your Podfile to the latest version possible.
You can also find reference from here.
You have to create a folk on git, of that libraries in which you are doing changes localy, and use that commit url instead of library name and version in pod file.
Whenever you are going to update lib, you will get your code.
This is solve your problem. :)

Always get build error : No such module 'Alamofire'

I followed the instruction of Alamofire in github,
I created an xcode project named cocoapods-test & I closed it.
I go to the project folder run pod init command which generates a Podfile. Then I added the following code to the Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 3.0'
Then, I run command pod install and this is the result in terminal:
Updating local specs repositories
CocoaPods 1.0.0.beta.6 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Analyzing dependencies
Downloading dependencies
Installing Alamofire (3.3.0)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `cocoapods-test.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
Then, in my project folder there is a new file called cocoapods-test.xcworkspace . I double clicked it which opens my xcode again, and I can see the Alamofire module.
Then, I opened my project's ViewController class, and import Alamofire . But no matter how many times I clean & build, I always get error No such module 'Alamofire' . Here is the screenshot:
Why I get this problem though I followed the instruction step by step?
(I am using XCode 7.2.1, Swift 2.1.1 & Alamofire 3.3.0)
======= UPDATE ========
I tried #LK Yeung 's answer, uncomment import Alamofire, then clean & build again, I got a bunch of compiler errors from Alarmofire:
You need to build the project successfully once before using the library
comment import Alamofire -> build -> uncomment import Alamofire
Make sure you have opened the "project_name".xcworkspace instead of "project_name".xcodeproj .As you are working on pods all the installed pod will be available only in your .xcworkspace project file.
I was having this exact same problem. Please make sure that you are on Xcode 7.3 and using Swift 2.2.
You can check your Swift version using xcrun swift -version. Updating Xcode to 7.3 should also automatically update Swift.
Updating Xcode resolved this issue for me.
You need to add the lib to 'the Link Binary With Libraries' section also
You can try put pod 'Alamofire', '~> 3.0' like below. And run pod install again.
target 'yourtarget' do
pod 'Alamofire', '~> 3.0'
end
If you're manually installing Alamofire (or any other framework) make sure your build configurations match between both your parent project and the sub project. For example, if your build configuration in your project is called 'Development', but Alamofire's is called 'Debug' you'll get the 'no such module' error.
Follow This Sequence
➼ Open Terminal, go to the project folder and run these commands:
sudo gem install cocoapods -n /usr/local/bin
pod install
➼ Go to this link and clear derive data folder:
~/Library/Developer/Xcode/DerivedData
➼ Then open project "xcworkspace" file and press:
Command + Shift + K
➼ and then:
Command + B
It should work now
Cheers!
try to latest updated install alamofire and also check u use alamofire latest is this in your xcode supported.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '<Your Target Name>' do
pod 'Alamofire', '~> 4.4'
end
try this above alamofire on your podfile
I had the same issue, the reason was that I installed the wrong version of alamofire.
I am using Xcode 7.3, swift 2.2, so alamofire 3.0 worked for me
remove the library using these steps mentioned by #Michal
Remove or uninstall library previously added : cocoapods
Then in your pod file
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, ‘9.3’ <-- your target version
use_frameworks!
target ’<your target name>’ do
pod 'Alamofire', '~> 3.0’
end
No such module 'Alamofire' Error
because you have not installed the Alamofire in your pod file
open Podfile and add this line
pod 'Alamofire'
double-check in Podfile if this line already is written then no need to write. then just update pod file
for updating your pod open your Podfile into terminal and dial
pod update

Resources