IOS local project dependencies (CocoaPods manages local libraries)
IOS local dependencies are actually troublesome, and static libraries are used. a and. framework, but when you use a static library to access the static library, your program will report an error, and version management is troublesome.
Then we thought of using cocoapods as the dependency library. Because it is the company's code, it cannot be put on github, so we need to build a local dependency library.
First, install git and cocoapods
Git installation and use let's look at this article http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000
The use of cocoapods installation to see the article http://code4app.com/article/cocoapods-install-usage
I will not elaborate on how to build this environment.
Apply for a github account and find New repository in the upper-right corner of the page.
After the creation is complete, we use git to clone to the local device. <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + PGJyPgo8L3A + cjxwpda-vcd4kphbyzsbjbgfzcz0 = "brush: java;"> git clone https://github.com/codesourse/podtest.git
Here we will use LICENSE and git Version Management
CocoaPods requires that all Pods dependent libraries must have license files; otherwise, the verification will not pass. There are many types of license. For details, refer to the website tl; dr Legal. When creating a github repository, I have selected a license of the MIT type.
Then we will create the. podspec file in this directory.
This file is the description file of the Pods dependent database. Each Pods dependent database must have only one description file. The file name must be consistent with the name of the dependent database we want to create. The name of the dependency library for my podtest is podtest. podspec.
Podspec File Content
Pod: Spec. new do | s |
S. name = "podtest"
S. version = "1.0.0"
S. summary = "A marquee view used on iOS ."
S. description = <-DESC
It is a marquee view used on iOS, which implement by Objective-C.
DESC
S. homepage = "https://github.com/wangzz/WZMarqueeView"
# S. screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
S. license = 'mit'
S. author = {"xia kejie" => "codesourse@gmail.com "}
S. source = {: git => '/Users/xiakejie/cocoapods/podtest',: tag => "1.0.0 "}
# S. social_media_url = 'https: // twitter.com/NAME'
S. platform =: ios, '4. 3'
# S. ios. deployment_target = '5. 1'
# S. osx. deployment_target = '10. 7'
S. requires_arc = true
S. source_files = 'podtest/**/*. {h, m }'
# S. resources = 'assets'
# S. ios. exclude_files = 'classes/osx'
# S. osx. exclude_files = 'classes/ios'
# S. public_header_files = 'classes/**/*. H'
S. frameworks = 'Foundation ', 'coregraphics', 'uikit'
End
Self-Resolution:
Name: directory name after pod import version: current version number deployment_target: configured target prefix_header_file: Pre-compiled header file path, insert the content of this file into the pch file of the Pod source: the specific path of the source, whether it is an http link or a local path requires_arc: whether arc source_files is required: Specify the files contained in the directory. Other optional parameters include: dependency: specifying dependencies, if the dependent library does not exist or the dependent library version does not meet the requirements, the following error occurs: libraries: Specifies the imported library, for example, sqlite3 frameworks: Specifies the imported framework weak_frameworks: weak link, for example, a project is compatible with both iOS6 and iOS7, but a framework is only available on iOS7. If a strong link is used, running on iOS7 will crash and weak_fr will be used. Ameworks can avoid this situation.
The entire podspec syntax is a nested structure from Pod: Spec. new do | s | to the last end is the largest loop, indicating the entire file imported by podspec. The end of each subspec is a sub-directory. Pods creates a logical directory for each subspec, which is equivalent to the group concept of Xcode. | ** | The name of subspec is in the middle. You can name it as needed, but the names used later must be consistent.
Wildcard description
A {bb, bc} def. {h, m} indicates four files: abbdef. h abbdef. m abcdef. h abcdef. m
*. {H, m, mm} indicates all. h. m. mm files.
Class/**/*. {h, m} indicates all. h. m files in the Class directory.
After this configuration, we need to use git to create a tag, and then cocoapods to make a tag and finally copy it to the local pod library.
git tag 1.0.0
set the new tag to 1.0.0
pod lib lint
Then put the podfile in the project you want to depend on. The content is
Pod 'podtest',: podspec => '/Users/xiakejie/cocoapods/podtest. podspec'
Finally, we only need to make a simple pod install
If
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/user_interface/error_report.rb: 13: in 'report': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding :: compatibilityError)
From/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/command. rb: 58: in 'report _ error'
From/Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command. rb: 300: in 'handle _ exception'
From/Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command. rb: 274: in 'rescue in run'
From/Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command. rb: 264: in 'run'
From/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/command. rb: 45: in 'run'
From/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/bin/pod: 43: in' '
From/usr/bin/pod: 23: in 'load'
From/usr/bin/pod: 23: in' '
Read this article.
Http://www.tuicool.com/articles/iaqU3im
Our dependent projects are created.
Reference
Http://blog.csdn.net/djl4104804/article/details/25408395
Http://www.iwangke.me/2013/04/18/advanced-cocoapods/
Http://guides.cocoapods.org/using/the-podfile.html