Because I have deleted all the articles in Jane’s book, I will add some original articles that I think are valuable for reference

CocoaPods is really possible to have a new pit every minute, so I can only update….

CocoaPods makes it easy for developers to use third-party libraries without having to manage dependencies themselves, and to use non-ARC or other compiler conditions on MAC:


  • The basic steps are to gem Install Cocoapods -> POD setup -> POD Init -> Edit Podfile -> Pod install -> open xcWorksapce To solve)

  • Here are several folders commonly used by POD:

    • /Users/{yourName}/Library/Caches/CocoaPodsThis is where the pod Git clone repository is cached

      Pod Install -> Download the SDWebImage into the Caches -> copy the library in the Caches to the project Pods according to the podSpec
    • /Users/{yourName}/.cocoapods/reposThis is where the cocoapods central index table is stored. The main repO is the master, which is required for pod to execute and for your new private REPO to be located
    • Under the project filePodsAccording to the contents of the Podfile generated file, which contains the source code

    So in extreme online situations (especially if it’s hard to update yourself), the ultimate skill is to simply copy your teammates’ Pods files to your own project files, and then pod install… , or you can copy your teammate’s Caches file,


# installation cocoapods

In order to prevent gem installation update failure, so the first to replace the domestic Taobao mirror source, otherwise in China’s network restrictions will be very slow

Please don’t confuse a thing, replace ruby source address, here is to install cocoapods this Library management software, installation directory by default in the/Library/ruby/Gems / 2.0.0 / Gems/cocoapods 1.1.1 /, Git is the git address of cocoapods’ central index table

Gem sources --remove https://rubygems.org/ // Update to ruby-China, gem sources has stopped-a https://gems.ruby-china.org/
Copy the code

Check it out.

gem sources -l
*** CURRENT SOURCES *** https://gems.ruby-china.org/
Copy the code

Install Cocoapods using gem

Sudo gem install Cocoapods // release 1.0 has been releasedCopy the code

** Unable to resolve dependencies: Cocoapods requires Cocoapods-Core (= 0.35.0), Claide (~> 0.7.0), XCodeProj (~> 0.20.2), Cocoapods – downloader (~ > 0.8.0) * *

Update the gem and start again

Sudo gem update --system //Copy the code

** sudo gem install cocoapods 启 动 : /usr/bin/xcodeproj


sudo gem install -n /usr/local/bin cocoapods
Copy the code

// If you have any questions please see below

Set up the POD central index table (initialize Cocoapods) – this is where the important issues are

If Pod Setup can easily download github code, you don’t have to

Specs means specifications, specifications

All third party libraries, pod lib Lint, are pushed into this specs.git, and pod install also goes to specs.git for version information, so I call it a central index

Cocospod is a centralized tool. Carthge is relatively decentralized. Therefore, carthge cannot search or check which version each library supports

Pod setup // will download the Specs. Git code to ~/.cocoapods/repo/master // if this is still too slow, try pod install --verboseCopy the code
  • Within the pod setup/Library/Ruby/Gems / 2.0.0 / Gems/cocoapods – 1.1.1 / lib/cocoapods/command/setup. Rb

        def run
          UI.section 'Setting up CocoaPods master repo' do
            if master_repo_dir.exist?
              set_master_repo_url
              set_master_repo_branch
              update_master_repo
            else
              add_master_repo
            end
          end
    
          UI.puts 'Setup completed'.green end // Omit some code.... def self.read_only_url'https://github.com/CocoaPods/Specs.git'  
    Copy the code

// The index is loaded by default. So if pod repo add master the failure / / you can try https://git.coding.net/CocoaPods/Specs.git directly change the url to you to replace the new git address, And it’s probably better to use SSH instead

  end
Copy the code
- ** If setup is slow or even stuck ** > (Github is slow, and the Spec. Git file number is very large), the 300+m git library will be very difficult to download successfully.) The specs warehouse mirror is changed to coding mirror or osChina mirror so it is recommended to change the data source firstCopy the code

pod repo remove master

// In this case, the osChina /coding code was used to provide git download, which was transferred to make it a little faster, but now I find that most of the Specs. Git are not updated… / / to be self-reliant behind pod repo add master at https://git.oschina.net/akuandev/Specs.git

> If the system displays a failure message or setup fails, the solution is as follows: -###1) Clone code manually- a [!]  To setup the master specs repo, please run `pod setup`. If you haven't updated your Git Specs, check osChina's 'Specs' for some updates, or make your own transitions (create new projects, import git urls, import cocoapods official Specs into your project, update your own... You can write a script and update it every day...) ! [Looking for new Git](http://upload-images.jianshu.io/upload_images/1111290-fb7f09546d64263c.png? imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)Copy the code

git clone https://git.oschina.net/yqszxx/Specs ~/.cocoapods/repos/master

/ / or using SSH, always feel that SSH way will hurry, HTTPS always stuck git clone [email protected]: yqszxx/Specs. Git ~ /. Cocoapods/repos/master

Pod setup // Be sure to setup completed after manually downloading the code

// Pod install –verbose –no-repo-update

> < p style = "max-width: 100%; clear: both; min-height: 1emcloneIf not, add the SSH key to 'git.oschina.net' and download the source code in SSH modeCopy the code

git clone [email protected]:akuandev/Specs.git ~/.cocoapods/repos/master


--- 


#CocoapodsCreate a new Podfile directly in the root directory where you want to add the cocoapods projectCopy the code

$pod init // Will generate template Podfile // or manually create $touch Podfile


## Edit Podfile
Copy the code

platform :ios pod ‘AFNetworking’

A single target depends on pod> Target must be specified in 1.0Copy the code

target ‘XXXTarget’ do pod ‘AFNetworking’ pod ‘Masonry’ end

Each time you change the Podfile, perform pod Update if it occurs during initialization: if it occurs after installationCopy the code

[!] The platform of The Target Pods (iOS 4.3) may not be compatible with Reachability (3.2) which has a minimum requirement Of iOS 6.0 – OS X 10.8

Then modify the Podfile toCopy the code

Platform: ios, ‘6.0’

If a large number of messages are displayed after the updateCopy the code

Error target overrides the OTHER_LDFLAGS…

Add ** 'Other Linker Flags' ** to the Building setting of the projectCopy the code

$(inherited)

Later open the project and click on the xcWorksapce suffix file, do not click on the original project file! [open] (HTTP: / / http://upload-images.jianshu.io/upload_images/1111290-3ae8e3273afdc017.png? ImageMogr2 /auto-orient/strip% 7cimageView2/2 /w/1240# Summary of problems:
## If the pod update/pod install command is executed too slowlyIf pod install > < span class = "reference" style = "box-sizing: box-sizing; color: RGB (50, 50, 50); line-height: 20px; white-space: inherit! Important;" And then the speed will go up quite a bit. The command to add parameters is as follows:Copy the code

pod install –verbose –no-repo-update pod update –verbose –no-repo-update


##gem install> ERROR: While executing gem... (Gem::FilePermissionError)Copy the code

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

- or:Copy the code

$mkdir -p $HOME/Software/ruby $export GEM_HOME=$HOME/Software/ruby $gem install cocoapods PATH=$PATH:$HOME/Sofware/ruby/bin $ pod –version

Or reinstall the RVMCopy the code

$ruby-e “$(curl -fsSL) $(curl -fsSL) $(curl -fsSL) $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” // Install RVM: $ \curl -sSL https://get.rvm.io | bash -s stable –ruby $ gem install cocoapods



## Invalid \\ 'Podfile' file
Copy the code

[!] Invalid Podfile file: incompatible character encodings: UTF-8 and ASCII-8BIT. Updating CocoaPods might fix the issue.

This is a coding problem for two reasons: 1. Your device really does not support UTF8, 2. You have a problem inputting text yourself look at the encodingCopy the code

localhost:xib cty$ locale

Appears after the command is executedCopy the code

LANG=”zh_CN.UTF-8″LC_COLLATE=”zh_CN.UTF-8″LC_CTYPE=”zh_CN.UTF-8″LC_MESSAGES=”zh_CN.UTF-8″LC_MONETARY=”zh_CN.UTF-8″LC_NUM ERIC=”zh_CN.UTF-8″LC_TIME=”zh_CN.UTF-8″LC_ALL=

Find all are zh, force setCopy the code

localhost:xib cty$ export LC_ALL=en_US.UTF-8 localhost:xib cty$ export.UTF-8

Check againCopy the code

LANG=”en_US.UTF-8″LC_COLLATE=”en_US.UTF-8″LC_CTYPE=”en_US.UTF-8″LC_MESSAGES=”en_US.UTF-8″LC_MONETARY=”en_US.UTF-8″LC_NUM ERIC=”en_US.UTF-8″LC_TIME=”en_US.UTF-8″LC_ALL=”en_US.UTF-8″

Ok, let's continue pod installCopy the code

[!] Invalid Podfile file: incompatible character encodings: UTF-8 and ASCII-8BIT. Updating CocoaPods might fix the issue.

The problem remains to try all possible configurationsCopy the code

gem install rails

thenCopy the code

gem install rdoc

thenCopy the code

gem install nokogiri –no-ri –no-rdoc

So once you've done that, you probably won't have a problem with it, but if you have a problem with text entry it's probably the solution to number two, so if you're typing it manually you need to be careful about that, you need to check that if you copy someone else's and you want to open up your keyboard preferences and set it to single quotes, colons I haven't figured out yet, The usual error will tell you what's wrong and I'm not going to do utF8 anymore, I'm not going to do the input method, but I've been switching around and setting things up and I still haven't solved the colon, so I'll just do itCopy the code

The master repo requires CocoaPods 0.18.1 –

This error occurred during the upgrade phase, upgradeCopy the code

gem update cocoapods

## A solution to the Library not Found for-lPods problem with cocopods management open source Library compilation+ Click on the Menu bar Product > Edit Scheme + select Build + Add Pods Static Library and keep Pods in the first position + Clean and Build projectIf the PCH File is not found, the PCH File is not foundIn the User Headers Search path(modified in both Project and Target)Copy the code

${SRCROOT} — Select Recursive on the right



## UFT -8 issue in Jenkins script package> [33mWARNING: CocoaPods requires your terminal to be using UTF-8 encodingCopy the code

export LC_ALL=”en_US.UTF-8″ pod install –no-repo-update

Copy the code