I am trying to add a module (SwiftyJSON) in my app but getting error. I followed https://www.raywenderlich.com/97014/use-cocoapods-with-swift tutorial for installing cocoapod on my Mac OS and it got installed successfully. I also got the module installed successfully. However, when I am trying to load the module in my swift file using the import SwiftyJSON statement I am getting error that says No such module SwiftyJSON.
Documentation for SwiftyJSON: https://github.com/SwiftyJSON/SwiftyJSON#integration
Podfile
platform :ios, '9.0'
target 'ApplePaySwag' do
use_frameworks!
# Pods for ApplePaySwag
pod 'SwiftyJSON'
pod 'AEXML'
target 'ApplePaySwagTests' do
inherit! :search_paths
# Pods for testing
end
end
Am I missing anything?
1) try putting use_frameworks! outside of target (under platform)
2) pod install
3) if import doesn't work try cleaning application (cmd + shift + k)
4) also clean derived data from the project -> xcode -> window -> projects -> derived data (delete)
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
target 'TestingModules' do
use_frameworks!
# Pods for TestingModules
pod 'SwiftyJSON'
pod 'AEXML'
target 'TestingModulesTests' do
inherit! :search_paths
# Pods for testing
end
target 'TestingModulesUITests' do
inherit! :search_paths
# Pods for testing
end
end
Add this in your podfile
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
use_frameworks!
def common_pods
end
target 'ApplePaySwag' do
common_pods
pod 'SwiftyJSON'
pod 'AEXML'
end
target 'ApplePaySwagTests' do
common_pods
end
and Run pod install,
then clean your project..
after that close the ApplePaySwag.xcodeproj and open ApplePaySwag.xcworkspace
Related
I have a newly created project, which I used
pod init
on to initialize cocoa pods
Im adding a single pod (TCPickerView ) to it and trying to use it but getting errors
podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Symphony' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'TCPickerView'
# Pods for Symphony
target 'SymphonyTests' do
inherit! :search_paths
# Pods for testing
end
target 'SymphonyUITests' do
inherit! :search_paths
# Pods for testing
end
end
I do
pods install
then open the Symphony.xcworkspace file and build
Then I add the example code from the TCPickerView site (see second screenshot which shows code and errors).
screenshot showing the pods library is included in the Symphony project
screenshot with code and error
There is no problem with your podfile, I tried it works, I guess you are missing import TCPickerView
It goes right after import UIKit in class ViewController
Can you update your pod file
platform :ios, '9.0'
use_frameworks!
target 'Symphony' do
pod 'TCPickerView'
target 'SymphonyTests' do
inherit! :search_paths
# Pods for testing
end
target 'SymphonyUITests' do
inherit! :search_paths
# Pods for testing
end
end
and try like this and reinstall pods again : pod install
Usage: import TCPickerView
I am new in swift programming . I am trying to download libraries for the project . I have installed cocoa pods : sudo gem install cocoa pods, created pod file with all libraries which I need : pod 'GoogleMaps'. After pod install I got an error:
Unable to satisfy the following requirements:
- `GoogleMaps` required by `Podfile`
- `GoogleMaps` required by `Podfile`
- `GoogleMaps (= 2.3.1)` required by `Podfile.lock`
Specs satisfying the `GoogleMaps, GoogleMaps (= 2.3.1)` dependency
were found, but they required a higher minimum deployment target.
[!] Automatically assigning platform ios with version 7.0 on target
Taxi for rider because no platform was specified. Please specify a
platform for this target in your Podfile. See
`https://guides.cocoapods.org/syntax/podfile.html#platform`.
My pod file:
# Uncomment the next line to define a global platform for your
project
# platform :ios, '9.0'
target 'Taxi for rider' do
# Comment the next line if you're not using Swift and don't want to
use dynamic frameworks
use_frameworks!
# Pods for Taxi for rider
pod 'Firebase'
pod 'Firebase/Storage'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'GoogleMaps'
pod 'GoogleMaps'
pod 'GooglePlaces'
pod 'GooglePlacesAPI'
pod 'GooglePlacePicker'
pod 'SwiftyJSON'
pod 'Firebase/Core'
pod 'Firebase/Storage'
end
Replace your podfile text with below text:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Taxi for rider' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Taxi for rider
pod 'Firebase'
pod 'Firebase/Storage'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'GoogleMaps'
pod 'GoogleMaps'
pod 'GooglePlaces'
pod 'GooglePlacesAPI'
pod 'GooglePlacePicker'
pod 'SwiftyJSON'
pod 'Firebase/Core'
pod 'Firebase/Storage'
end
Below is wrong line in your code:
# Uncomment the next line to define a global platform for your
project
Which should be:
# Uncomment the next line to define a global platform for your project
And you have added pod 'GoogleMaps' multiple times.
You should define a platform for your project in your Podfile. Append this to the beginning of your Podfile:
platform :<ios, macos, tvos etc.>, '<version of the OS>'
Example:
platform :ios, '9.0'
Step Of Install Cocoa Pods.
Step 1 - Close your Xcode project which you install pod file. and Open terminal.
Step 2 - type cd command and Drag your project path.
Step 3 - press Enter and type pod init conmmand then open your project folder, now you can see pod file
Step 4 - open pod file and write pod name which you install
Step 5 - save and close pod file and again open terminal and write pod install command and wait few minutes to install pod
After install pod go to your project folder and open .work space file and enjoy.
now pod is installed enjoy and used.
I'm trying to add Google Places SDK to my xcode project but keep getting the error
Unable to find a specification for `GooglePlacePicker`
This is my pod file
# Uncomment the next line to define a global platform for your project
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'Restaurant' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Restaurant
pod 'GooglePlaces'
pod 'GooglePlacePicker'
pod 'GoogleMaps'
target 'RestaurantTests' do
inherit! :search_paths
# Pods for testing
end
target 'RestaurantUITests' do
inherit! :search_paths
# Pods for testing
end
end
The funny thing is, if I remove 'GooglePlaces' and 'GooglePlacePicker' it installs the 'GoogleMaps' perfectly fine.
i don't know if someone have the same problem at the moment, but i'm trying to import Firebase in my app but it only shows "No such module for Firebase". Could anyone please help me?
This is the error i get every time.
EDIT: (Sorry for the noobie errors), this is the code in the Podfile:
target 'CosplaCentral' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for CosplaCentral
target 'CosplaCentralTests' do
inherit! :search_paths
# Pods for testing
end
target 'CosplaCentralUITests' do
inherit! :search_paths
# Pods for testing
pod 'Firebase'
end
end
Update your pod file with the code below, then in Terminal direct to your project file and do pod install (make sure Xcode is closed when doing so) and then load up your project again then retype import Firebase
platform :ios, '8.0'
target 'CosplaCentral' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for LT Sounds
pod 'Firebase'
pod 'Firebase/Auth'
end
I was trying to install Firebase's pod for messaging and I got this error in terminal....
"Specs satisfying the Firebase/Messaging dependency were found, but they required a higher minimum deployment target."
This is what I have in my podfile
"# 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 'PZPlayer' do
pod ‘Firebase’
pod ‘Firebase/Messaging’
end
"
How can I fix this problem?
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'PZPlayer' do
pod ‘Firebase’
pod ‘Firebase/Messaging’
end
This should be your podfile. Try it.
I did more or less than the guy told us
but my steps were a little different:
1) on the Terminal:
go to your project folder:
1.1) cd Desktop/YourApp
1.2) YOURMAC:YourApp Fernanda$ sudo pod init
2) change your file Podfile to:
` # Uncomment this line to define a global platform for your project
platform :ios, '8.0'
target 'YourApp' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for YourApp
pod 'Firebase'
end `
3) on the Terminal: pod install
4) Now, change your file Podfile again to:
`# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
target 'YourApp' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for YourApp
pod 'Firebase'
pod 'Firebase/Messaging'
end `
5) on the Terminal: pod update
Sorry my about my English,
Good Look!