Can't Integrate Google Places API - ios

I am trying to use the GooglePlaces iOS API; however, every time I follow the directions for installing it via CocoaPods, I always get a Linker Command error. I've tried the steps about a million times and always get that error after building. Furthermore, I am using the workspace file that documentation recommends and I believe that I have followed all of the steps correctly. Can someone please help me?
Xcode version: 8.3.2 (8E2002)
Pod File Content:
source 'https://github.com/CocoaPods/Specs.git'
target 'MoodSwings' do
pod 'GooglePlaces'
end
Xcode Error:
ld: framework not found GoogleMapsBase
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thanks!

First I Deintegrate Cocoapods from your project using this link Deintegrating and Removing Cocoapods from your project after that using pod init I create pod file again this is the podfile updated content
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MoodSwings' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MoodSwings
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'GooglePlaces'
pod 'GooglePlacePicker'
pod 'GoogleMaps'
target 'MoodSwingsTests' do
inherit! :search_paths
end
target 'MoodSwingsUITests' do
inherit! :search_paths
# Pods for testing
end
end
After that I remove all configurations in Build Setting -> Framework Search Path and your project finally works!!
here is the repo Github repo

Related

FMDB library not found while using Cocoapods

I have an app in which I am using cocoapods to download third party libraries. I have Salesforce sdk and also firebase. Both Salesforce's SmartStore and Firebase are dependent on FMDB. If I remove Firebase pod and do a pod update it is compiling fine without any error. But, if I add firebase libraries to Pod, I get
Library not found for -lFMDB
Linker command failed with exit code 1 (use -v to invocation)
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
target 'App' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
use_modular_headers!
# Pods for App
source 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Specs.git'
source 'https://github.com/CocoaPods/Specs.git'
pod 'Firebase/Analytics'
pod 'Firebase/Crashlytics'
pod 'SalesforceSDKCore','7.3.0'
pod 'SmartStore','7.3.0'
pod 'SmartSync','7.3.0'
pod 'SalesforceAnalytics','7.3.0'
pod 'SalesforceSDKCommon','7.3.0'
end
I am not sure what is the problem and how to resolve it. Any help is much appreciated.
In case if anyone else has the same problem, remove libraries from Other Linker Flags. As in pod file, I have use_frameworks! in pod file,I believe you don't have to mention them in Other Linker Flags.

Swift create cocoapod with dependency error

Trying my hand at building a cocoapod and I need to include the SwiftKeyChainWrapper cocoapod as a dependency. I have the pod linked inside the .podSpec file but (1) I can't find a way to include it in the development pod whilst I build it to use methods and (2) when I run pod lib lint --verbose --no-clean --use-libraries I get the following error:
ERROR | [iOS] unknown: Encountered an unknown error (Pods written in Swift can only be integrated as frameworks; add use_frameworks! to your Podfile or target to opt into using it. The Swift Pods being used are: SwiftKeychainWrapper
Inside the pod project I have the following:
platform :ios, '11.0'
use_frameworks!
target 'MyPod_Example' do
pod 'MyPod', :path => '../'
target 'MyPod_Tests' do
inherit! :search_paths
end
end
And the dependency is listed:
s.dependency 'SwiftKeychainWrapper'
Thanks
--use-libraries is the flag to use static libraries instead of dynamic frameworks, you should remove it from your lint command to make it work as a framework.

Undefined symbols for architecture arm64: linker command warning

I updated my pods, and then after closing the project and reopening it, I received this error that I've been trying to figure out for 5 hours, and nothing has worked for me. I've been told to change the architectures, but all that I've tried isn't working, and I'm struggling a lot. Here is my pod file
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'Vloggle' do
# Comment the next line if you're not using Swift and don't want to use
dynamic frameworks
use_frameworks!
pod 'Firebase/Auth'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Storage'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'
pod 'SDWebImage'
pod 'KILabel'
pod 'Firebase'
pod 'Firebase/Messaging'
pod 'ColorSlider'
pod 'lottie-ios'
# Pods for Vloggle
target 'VloggleTests' do
inherit! :search_paths
# Pods for testing
end
target 'VloggleUITests' do
inherit! :search_paths
# Pods for testing
end
end
Also, here is a screenshot of my build settings.
Here is the error message
Latest iOS version supports 64bit of Architecture. So you have to use Valid Architectures. You can check this in the "Architecture" section in build settings.
You can see the "Architecture" setting in the screenshot which is as follows:-
If your architecture is correct then check the "Other Linker Flags".
You can change the "Other Linker Flags" in the "Build Settings".
Search "Other Linker Flag" in the search area in the "Build Settings" and add the following code in it
$(inheriterd) will add all type of linker flags generated by the pods while installation of pods
https://i.stack.imgur.com/LgHV6.png
https://i.stack.imgur.com/Xouyo.png
can you please check the following settings in your project:-
1) Select your project target
2) Go to Build Phases
3) Go to Link Binary With Libraries
4) Press + to link
Make sure all libraries under Workspace have been added. If any library is missing then please add the missing library. Please check the attached screenshot
https://i.stack.imgur.com/NghA7.png

How to solve "ld: framework not found Alamofire" in swift 3

my project was running fine but when i added alamofire and it is not working.
it is giving following error
ld: warning: directory not found for option
'-F/Users/banglafire/Desktop/mysios/Build/Products/Debug-iphonesimulator/Alamofire'
ld: framework not found Alamofire clang: error: linker command failed
with exit code 1 (use -v to see invocation)
additional information
Cocopad version 1.3.1
my pod file
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'My' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for My
pod 'Alamofire'
end
How do i solve it? Please help!
I was facing same problem. So i think you are opening .xcodeproj. you need to open .xcworkspace
I think there are some issues with your Pod file should be as below:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'My' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Alamofire', '~> 4.4'
target 'MyTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyUITests' do
inherit! :search_paths
# Pods for testing
end
end
try to remove Pod file and again install the pod file and add pod-like this. Hope this could help you.
Try to add the version of the alamofire
pod 'Alamofire', '~> 4.5'
Then run pod install
Did you update your pod on project folder already ?
Also check if your pod is correct or not.
https://github.com/Alamofire/Alamofire
When you add something pod on your project, you still need to update your folder.
Try use terminal -> then go to your folder project -> type pod install
I recently encountered this problem aswell.
I tried a lot of the suggested fixes on here, but none of them actually fixed the problem.
The actual problem was an incorrect value that was set in the Build Settings of the app.
After setting Per-configuration Build Products Path to:
CONFIGURATION_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
the problem was resolved and my build succeeded.

Xcode can't find Alamofire, error: No such module 'Alamofire'

I'm trying to include Alamofire in my Swift project following the github(https://github.com/Alamofire/Alamofire#cocoapods) instruction.
I've created a new project, navigated to the project directory and run this command sudo gem install cocoapods. Then I faced following error:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod
After searching I managed to install cocoapods by running this command sudo gem install -n /usr/local/bin cocoapods
Now I generate a pod file by pod init and edited it this way:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'ProjectName' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Law
pod 'Alamofire'
target 'ProjectNameTests' do
inherit! :search_paths
# Pods for testing
end
target 'ProjectNameUITests' do
inherit! :search_paths
# Pods for testing
end
end
Finally I run pod install to install Alamofire. After that I open the project and import Alamofire statement gives me following error No such module 'Alamofire'
Update-1: Results of pod install is:
Analyzing dependencies
Downloading dependencies
Using Alamofire (3.4.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
Open the .xcworkspace not the .xcodeproj
go to Product -> Scheme -> Manage Schemes...
and check Alamofire true
this work for me
Sometimes with no reason xcode can't load a module Alamofire. It can happen after a work session, after opening a project. The fix for this is to select a schema -> Alamofire, and run. If the message is "Successful", the schema can be changed back to project and it will work with no problems.
I suggest you to change your pod file like this below:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
pod 'Alamofire', '~> 3.0' <<<---- Alamofire library is cross beetween projects
target 'NotifyM' do
end
target 'NotifyMTests' do
end
target 'NotifyMUITests' do
end
Another thing is use_frameworks! you should use this if the project is Objective-C based and try to use Swift pod library.
UPDATE: for the new cocoapods version 1.x the shared library should be like this:
# There are no targets called "Shows" in any Xcode projects
abstract_target 'Shows' do
pod 'ShowsKit'
pod 'Fabric'
# Has its own copy of ShowsKit + ShowWebAuth
target 'ShowsiOS' do
pod 'ShowWebAuth'
end
# Has its own copy of ShowsKit + ShowTVAuth
target 'ShowsTV' do
pod 'ShowTVAuth'
end
end
as indicated into cocoapods website :http://guides.cocoapods.org/using/the-podfile.html
you have to clean project and build, before you can import that library.
Install this way Pod file
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'NotifyM' do
pod 'Alamofire', '~> 3.0'
end
target 'NotifyMTests' do
end
target 'NotifyMUITests' do
end
I suggest that and it's work for me :
platform :ios, '8.0'
use_frameworks!
target 'App' do
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git'
end
After that, run : pod install in your project repository
2021 M1 USERS
according to: https://developer.apple.com/forums/thread/123614?answerId=683594022#683594022
close XCode
open Finder app and show there "Applications"
right click on icon Xcode and click on "Get info" (or something similar)
there is checkbox "Open with Rosseta" (or something similar). Select it
run Xcode again and try to build
it worked for me hope it works for you.
After a lot of efforts and all solutions provided above. I have fixed on Xcode 13.0:
Use for Simulator:
Go to:
- Build settings -> EXCLUDED_ARCHS = arm64
- Build settings -> VALID_ARCHS = arm64e armv7 armv7s arm64 x86_64
Use for Realm Device:
Go to:
- Build settings -> EXCLUDED_ARCHS =
- Build settings -> VALID_ARCHS = arm64e armv7 armv7s arm64
You should tap the Target to select Alamofire and build it once before coding.
When using Cocoapods to include dependencies always open your .xcworkspace
In Podfile use use_frameworks!
Remove any linked libraries from build phases.
In Build Setting look for Framework Search Path and add $(inherited) in both debug and release.
Do the same for Header Search Path too.
Now try a clean build.

Resources