I create a swift cocoa touch framework according to create cocoapod with siwft
and it works fine, But there is another problem, my framework will dependency on other framework, such as SwiftyJSON.
And I try add
s.dependency "SwiftyJSON", "~> 2.3"
into the .podspec file.
But when I try to build my 'Example', still error happens :
'No such module SwiftyJSON'
Open your terminal and goto to your folder project. Then follow this step. Type this command in your terminal.
open -a TextEdit Podfile
Then copy this pod 'SwiftyJSON', :git =>'https://github.com/SwiftyJSON/SwiftyJSON.git'
put into Podfile. Then save it. And type this command in your terminal.
pod install
Hope it will help you.
First you should install cocoapods package in your mac
check this tutorial to do this How to install cocoapods?
Then you can install any cocoapods for any project by the following steps
open terminal
navigate to the root path for the project, example
cd /Users/mac/Desktop/cocoatest
then type
pod init
(the will generate file "Podfile" ) open it
the content for this file will be something like this:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'cocotest' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for cocotest
end
uncomment this line # platform :ios, '9.0'
and then add you cocoapods under this line
# Pods for cocotest
like
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'cocotest' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for cocotest
pod "SwiftyJSON", "~> 2.3"
end
then save the file
after that type pod install in terminal and it will create file with
xcworkspace extension open it and that is your project
Related
when npm install command runs, It installs all the packages mentioned in the package.json.
when pod install command is run, which is the base file to install all required pods?
Is there any file in iOS like package.json that decides which pods have to be installed?
The Podfile itself. It's a ruby file looking something like this:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'ProjectName' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
pod 'Alamofire', '5.6.2'
end
I am working on an app, which requires cocoapods. In the manual of this app is written
Add this to your Podfile:
pod 'SwiftSocket'
And run then pod install
But when I make a pod file using pod init into my folder and then open -a Xcode Podfile and there I add lines
target 'SwiftSocket' do
pod 'SwiftSocket'
end
and the last pod install it says me an error
Unable to find a target named SwiftSocket, did find SwiftSocket iOS, SwiftSocket macOS, SwiftSocket tvOS, and iOS Example.
Edit____________
Picture of my folder.
and how looks my Podfile now
It is working perfectly, check out my podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'Demo' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'SwiftSocket'
# Pods for Demo
end
Demo is the project name. Target name will be your project name.
I am trying to use the library react-native-localization in my ReactNative app for ios, when I try to run I get the following error:
Any ideas how to fix?
I found the solution to my own question.
Add to the "Podfile" this 2 lines:
pod ‘ReactNativeLocalization’,
:path => “../node_modules/react-native-localization”
Here is my complete "PodFile" example.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Transit' do
project 'Transit.xcodeproj'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
# use_frameworks!
pod ‘Firebase/Core’
pod ‘Firebase/Messaging’
pod ‘ReactNativeLocalization’,
:path => “../node_modules/react-native-localization”
end
$
Then execute the command
pod install
To install the necessary components.
In my react-native app I want to integrate cocoapod,after
sudo gem install cocoapods. When I create the pod file is using pod init command ,then the pod file is missing the target .
Below is the pod file code.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target ' ' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for
end
Due to this when installing pod framework ,its not working.
I'm using Xcode 7 for ios development. I'm new to Swift. I use in my project CocoaPods. But I'm unable to import the files into our project.
MY Cocoapodfile is
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
target 'SCLAlertView2' do
pod 'SCLAlertView'
end
target 'IceCreamShopTests' do
end
Podfiles are created. But I'm unable to import the files.
import SCLAlertView
I'm getting no such module error getting. How to resolve it. Any help welcome.
Not only podfile has to be created, you also have to run
pod install
Or, if you already installed and you want to update/add new libraries:
pod update
Then, build the project again (Command+B)
Follow the "Getting Started" instructions at cocoapods.org. Here are the specific steps listed:
List the dependencies in a text file named Podfile in your Xcode project directory:
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod 'AFNetworking', '~> 2.6'
pod 'ORStackView', '~> 3.0'
pod 'SwiftyJSON', '~> 2.3'
end
Tip: CocoaPods provides a pod init command to create a Podfile with smart defaults. You should use it.
Now you can install the dependencies in your project:
$ pod install
Make sure to always open the Xcode workspace instead of the project file when building your project:
$ open App.xcworkspace
Now you can import your dependencies e.g.:
#import <Reachability/Reachability.h>