install

  1. install Ruby
    CocoaPods be based on Ruby Language development , So the installation CocoaPods It needs to be installed before Ruby Environmental Science . Fortunately, Mac System default Ruby Environmental Science , If not, please find and install . Check for installation Ruby:
    $ gem -v2.0.14

Installation will prompt the current Ruby edition .gem Introduce :gem It's a management Ruby Standard packages for libraries and programs , It passes through Ruby Gem( Such as http://rubygems.org/ ) Source 、 install 、 Upgrade and uninstall packages , It's very convenient .

  1. Replace gem Source
    Because of the problem of domestic network gem The source interrupts intermittently , Why do you know . So we need to replace gem Source , Use Taobao's gem Source
    [https://ruby.taobao.org/.](https://ruby.taobao.org/%E3%80%82)
    First step : Remove the default source
    gem sources --remove https://rubygems.org/

The second step : Specify the source of Taobao
gem sources -a https://ruby.taobao.org/

The third step : Check whether the specified source is Taobao source
$ gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org/

If it is https://ruby.taobao.org/, The replacement is successful .

  1. install CocoaPods
    After changing to Taobao source, execute the following command to install :
    sudo gem install cocoapods
    If you use the domestic image instead gem install cocoapods Report errors :
    ERROR: While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: cocoapods requires cocoapods-core (= 1.1.1), cocoapods-downloader (< 2.0, >= 1.1.2), cocoapods-trunk (< 2.0, >= 1.1.1), xcodeproj (< 2.0, >= 1.3.3)

    perform :
    sudo gem update --system && sudo gem install cocoapods

Report errors :
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj

perform :
sudo gem install -n /usr/local/bin cocoapods
installation is complete , Enter the following command to check whether the installation is successful :
$ pod --version
1.1.1

cd Go to your project directory
establish Podfile
vim Podfile
If not created Podfile
The file will not install , CocoaPods I don't know how to change the installation instructions , How to install it , Right .
[!] No `Podfile' found in the project directory.

Enter the following code ( The configuration file , Third parties that need to be added ):

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '8.0'

inhibit_all_warnings!

target ' project name ' do

pod 'AFNetworking', '~> 2.6.0'

end

Then save to exit
esc
:wq
perform
pod updateOR pod install.
If you make a mistake :

[!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `master`.
You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.

perform :
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer(xcode Catalog )

The red part is mine Xcode The path of , Notice in the code above "--" and "select" There is a space between .

The solution is to use the code :

And then there are problems : Generally, it will output at this time --unalbe to get active developer directory

defaults write com.apple.finder _FXShowPosixPathInTitle -bool TRUE;killall Finder

In that case, it will be OK , Then use your Xcode Just replace the red part above with the path of .

Problem description

1:[!] The 'master' repo requires CocoaPods 1.0.0 - (currently using 0.39.0) Update CocoaPods, or checkout the appropriate tag in the repo.

Question why : Not updated to the latest cocoapods edition

sudo gem install -n /usr/local/bin cocoapods –pre

If there is an error or other problem

sudo gem update --system && sudo gem install cocoapods

Error message appears :
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj

perform :
sudo gem install -n /usr/local/bin cocoapods

Enter the following command to check for success :
pod --version
1.1.1

2:[!] The dependency `AFNetworking (~> 2.6.0)` is not used in any concrete target. etc.

Question why :podfile Upgrade to the latest version ,pod The content in must clearly indicate the third party library used target

You can modify Podfile Profile of file , Make it compatible without specifying a fixed version ; And no mistakes

platform :ios, '8.0'

inhibit_all_warnings!

target ' project name ' do

pod 'AFNetworking', '~> 2.6.0'

end

3:Updating local specs repositories

encounter pod install perhaps pod update Stuck in... For a long time Updating local specs repositories

  • A common solution is to skip updates cocoapods Of spec Warehouse
  • pod install --verbose --no-repo-update
  • pod update --verbose --no-repo-update
  • The best way is
  • pod repo remove master
  • pod setup
  • pod install

4:[!]Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.

Don't use text editing to edit Podfile, Use Xcode edit , Or use the terminal to type commands to edit . Or the input format is wrong , No running version entered :$platform:ios, ‘8.0‘

5: Use cocoapods There is no code prompt in the header file after importing the third-party class library ?

choice Target -> Build Settings menu , find \”User Header Search Paths\” Set item , Add a value "${SRCROOT}", And choose \”Recursive\”

6:[!]Unable to find a target named '  ';

Podfile The project file of is inconsistent with the name of the project . Change the name to the same

7:syntax error ,unexpected end-of-input,expecting keyword_end

podfile There is something wrong with the way of writing , standards-of-use podfile Writing

platform :ios, '8.0'

inhibit_all_warnings!

target ' project name ' do

pod 'AFNetworking', '~> 2.6.0'

end

8: Analyzing dependencies

[!]Could not automatically select an Xcode project . Specify one in your Podfile like 50 : xcodeproj ' path / to / Project . xcodeproj

Create an empty folder of your own , There's no building project

processing method : Delete this empty project , Rebuild a project , According to the above knowledge point to explain step by step .

9:pod After importing, it appears "_OBJC_CLASS_$_xxx"

target->build phases->link binary with libraries add to xxx.a

If not pod Imported class library , It's a problem

reason : There is no check mark when creating the class "add to targets"

target->build phases->compile sources add to .h,.m file

or ( It's suggested to use the above )
stay Build Setting Medium Other Linker Flags Add $(OTHER_LDFLAGS)

10:Xcode - ld: library not found for -lPods

When a new one is added Target, also pod install after , Because the creation project is created by default Target Of Build Phases The old .a, for example libPods.a, When new additions Targget after ,libPods.a Has become libPods-Test.a, And new Target The name is Second, Rely on the .a by libPods-Second.a. therefore libPods.a It is no longer quoted at this time , And will not be generated , If it is quoted anywhere, an error will be reported , The solution is that there is a problem Target Of Build Phases Delete the useless .a quote , for example libPods.a

target->build phases->link binary with libraries

11:pod Import library , No header file found

stay TARGETS -> Search Paths -> User Header Search Paths in write in  ${SRCROOT} Then change the following parameter to recursive:

12: If you want to remove Cocoapods, Then you can :

a. Delete project folder Podfile、Podfile.lock And Pods Folder

b. Delete xcworkspace file

c. Use xcodeproj File open project , Delete Frameworks Under group Pods.xcconfig And libPods.a quote

d. In engineering settings Build Phases Delete Check Pods Manifest.lock And Copy Pods Resources

Accidentally delete pods.xcconfig, appear diff: /../Podfile.lock: No such file or directory

sudo pod install Just a moment

If there is a permission problem when compiling , For project folder $sudo chmod 777 path-to-project-folder/*

$sudo chown 777 path-to-project-folder/*

13: appear /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:417:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)

Reopen a terminal , then pod install, Don't sudo pod install.

14: Delete CocoaPods edition , And install the specified version

For example, I had finished installing CocoaPods 1.0.0 edition , But we found that its implementation is quite different from the previous one , Decided to go back to 0.39 This is a more stable version ; You can use the command to delete the local CocoaPods edition , Then specify to install a specific version ;

a uninstall cocoapods( It will prompt you to delete the local version, which version can also be deleted )

sudo gem uninstall cocoapods

b install 0.39 edition

sudo gem install -n /usr/local/bin cocoapods -v 0.39

15: to update CocoaPods Or you've added a third party manually before SDK change to the use of sth. Cocopods, The following errors may occur

error 1:
 [!] The `Paopao [Debug]` target overrides the `PODS_ROOT` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target. [!] The `Paopao [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target. [!] The `Paopao [Release]` target overrides the `PODS_ROOT` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target. [!] The `Paopao [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.

The reason for this warning is that the project Target Some of the settings in ,CocoaPods Also made the default settings , If the two settings are inconsistent , It will cause problems .

I want to use CocoaPods Settings in , They are defined in my project PODS_ROOT and Other Linker Flags The place of , Put their value in $(inherited) Replace , Access terminal , perform

 pod update

The warning is gone

A simple and crude way :

Click project file project.xcodeproj, Right click Show package content , Open with text editor project.pbxproj, Delete OTHER_LDFLAGS The place of , preservation ,pod update, The warning is gone ....

16:

17:

 

iOS cocoapods More about upgrades and issues

  1. CocoaPods An error was reported when upgrading and installing the third party library

    CocoaPods After upgrading ( The latest version 1.0.1), The following error will be reported when installing the third-party library : The dependency `AFNetworking (~> 3.1.0)` is not used in ...

  2. iOS:CocoaPods Detailed explanation

    Original address :http://blog.csdn.net/wzzvictory/article/details/18737437 One . What is? CocoaPods 1. Why CocoaPods It's going on iOS ...

  3. IOS CocoaPods Detailed usage

    Ever since CocoaPods in the future , We don't need to do all these complicated jobs by ourselves , We only need to do a little bit of configuration work ,CocoaPods Will do everything for us   One . What is? CocoaPods 1. Why CocoaPo ...

  4. IOS CocoaPods Usage of

    Ever since CocoaPods in the future , We don't need to do all these complicated jobs by ourselves , We only need to do a little bit of configuration work ,CocoaPods Will do everything for us   One . What is? CocoaPods 1. Why CocoaPo ...

  5. experiment 5: IOS Upgrade and restore

    experiment 5:  IOS Upgrade and restore The experiment purpose Through this experiment, we can master 1)     master IOS Upgrade normally IOS2)    IOS Use in case of loss TFTP recovery IOS3)    IOS Use in case of loss X ...

  6. iOS -- CocoaPods

    CocoaPods What is it? ? CocoaPods It's a person in charge of management iOS Tools of the third party open source library in the project .CocoaPods Project source code in GitHub( https://github.com/CocoaP ...

  7. iOS CocoaPods Version installation issues

    Install today salesforce Medium pods, This is inside podfile # Uncomment this line to define a global platform for your project ...

  8. iOS - CocoaPods Third party open source framework management

    1.CocoaPods CocoaPods It's a person in charge of management iOS Tools of the third party open source library in the project .CocoaPods Project source code in Github Upper management . The project began in 2011 year 8 month 12 Japan , Here ...

  9. iOS CocoaPods Installation and use diagram

    Cocoapods Installation steps 1. upgrade Ruby Environmental Science sudo gem update --system If Ruby No installation , Please refer to   How to be in Mac OS X Installation on Ruby Running environment 2. install CocoaPo ...

Random recommendation

  1. GET And POST The difference between

    from http://blog.csdn.net/darxin/article/details/4944225#comments HTTP Requested GET And POST The essential difference of ways can be referred to hyddd stay < shallow ...

  2. iOS UILabel Get the height and UITableCell Get height dynamically ( Take the interception of express information as an example )

    #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @pr ...

  3. stay MS CRM 4.0 I quote JS file

    quote : http://blog.csdn.net/qzw4549689/article/details/6027987 1. Write it well JS Code , stay ISV Create a new directory under the directory javascripts, take JS file ...

  4. hadoop Text to sequence file

    Used in the past hadoop Because mahout Many of them require input files as sequence files , So it involves converting a text file into a sequence file or a sequence file into a text file ( Because we had to analyze mahout Source code , So you have to see what the input file is ...

  5. python in enumerate function

    enumerate Functions are used to traverse elements in a sequence and their subscripts : >>> for i,j in enumerate(('a','b','c')):  print i,j 0 a 1 b ...

  6. React Component usage of

    React.createClass() Chinese translation  https://discountry.github.io/react/3.4K ( https://doc.react-china.org868 ) ...

  7. vue2.0 Source code interpretation ( One )

    After reading the tutorial of Chinese community again, I'll start to do it next vue2.0 The source code of ! notes : When interpreting the source code, we must cooperate with vue2.0 The life cycle of API Look at the documents together vue2.0 The life cycle of is divided into 4 The main process is create. establish --- example ...

  8. Google&#39;s Machine Learning Crash Course #04# First Steps with TensorFlow

    1. Use TensorFlow The advice of Which API(s) should you use? You should use the highest level of abstraction tha ...

  9. BootstrapTable( Source code attached )

    Bootstrap combination BootstrapTable Use , It is divided into two types of test display list . Refer to the css: <link href="@Url.Content("~/Css/bootst ...

  10. java Generate db file

    There is a need at work , Just need to put mysql Some table data generation in db file , For clients , Client side usage sqlite database : First we need to add... To the project Sqlite JDBC rely on <dependency&g ...