其他分享
首页 > 其他分享> > 实践:Cocoapods私有库搭建、制作、引用

实践:Cocoapods私有库搭建、制作、引用

作者:互联网

说明:私有仓库我是在:iMac本地-docker-gitlab存储的 如下:

操作实践方案 如下:

 

 操作命令记录 如下:

nixs@nixs-iMac Android % du -sh /Users/nixs/Documents/AndroidDev/2020-iOS我自己开源库/Android/LoveHome_Android
224M	/Users/nixs/Documents/AndroidDev/2020-iOS我自己开源库/Android/LoveHome_Android
nixs@nixs-iMac Android % cd /Users/nixs/Documents/docker/iOS_public/ios_framework
nixs@nixs-iMac ios_framework % git clone http://localhost:81/ios_private/mydemoprinttest.git
Cloning into 'mydemoprinttest'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
nixs@nixs-iMac ios_framework % ls
README.md	Res		VideoPlayerDemo	VideoPlayerLib	mydemoprinttest
nixs@nixs-iMac ios_framework % cd mydemoprinttest
nixs@nixs-iMac mydemoprinttest % ls
README.md
nixs@nixs-iMac mydemoprinttest % pod lib create mydemoprinttest
Cloning `https://github.com/CocoaPods/pod-template.git` into `mydemoprinttest`.
Configuring mydemoprinttest template.

------------------------------

To get you started we need to ask a few questions, this should only take a minute.

If this is your first time we recommend running through with the guide:
 - https://guides.cocoapods.org/making/using-pod-lib-create.html
 ( hold cmd and click links to open in a browser. )


What platform do you want to use?? [ iOS / macOS ]
 > iOS

What language do you want to use?? [ Swift / ObjC ]
 > Objc

Would you like to include a demo application with your library? [ Yes / No ]
 > YES

Which testing frameworks will you use? [ Specta / Kiwi / None ]
 > None

Would you like to do view based testing? [ Yes / No ]
 > YES

What is your class prefix?
 > NI

Running pod install on your new library.

Analyzing dependencies
Downloading dependencies
Installing FBSnapshotTestCase (2.1.4)
Installing mydemoprinttest (0.1.0)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `mydemoprinttest.xcworkspace` for this project from now on.
Pod installation complete! There are 2 dependencies from the Podfile and 2 total pods installed.

 Ace! you're ready to go!
 We will start you off by opening your project in Xcode
  open 'mydemoprinttest/Example/mydemoprinttest.xcworkspace'

To learn more about the template see `https://github.com/CocoaPods/pod-template.git`.
To learn more about creating a new pod, see `https://guides.cocoapods.org/making/making-a-cocoapod`.
nixs@nixs-iMac mydemoprinttest % ls
ls: .: Operation not permitted
nixs@nixs-iMac mydemoprinttest % cd ..
nixs@nixs-iMac .Trash % ls
ls: .: Operation not permitted
nixs@nixs-iMac .Trash % cd /Users/nixs/Documents/docker/iOS_public/mydemoprinttest
nixs@nixs-iMac mydemoprinttest % ls
Example			LICENSE			README.md		_Pods.xcodeproj		mydemoprinttest		mydemoprinttest.podspec
nixs@nixs-iMac mydemoprinttest % cd Example
nixs@nixs-iMac Example % ls
Podfile				Pods				mydemoprinttest			mydemoprinttest.xcworkspace
Podfile.lock			Tests				mydemoprinttest.xcodeproj
nixs@nixs-iMac Example % pod install --no-repo-update
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 2 dependencies from the Podfile and 2 total pods installed.
nixs@nixs-iMac Example % pod install --no-repo-update
Analyzing dependencies
Downloading dependencies
Installing Masonry (1.1.0)
Generating Pods project
Integrating client project
Pod installation complete! There are 3 dependencies from the Podfile and 3 total pods installed.
nixs@nixs-iMac Example % pod install --no-repo-update
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 3 dependencies from the Podfile and 3 total pods installed.
nixs@nixs-iMac Example % pod install --no-repo-update
Analyzing dependencies
Downloading dependencies
Installing AFNetworking (3.2.1)
Installing NITools (0.2.0)
Installing YYText (1.0.7)
Generating Pods project
Integrating client project
Pod installation complete! There are 4 dependencies from the Podfile and 6 total pods installed.
nixs@nixs-iMac Example % pod install --no-repo-update
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 4 dependencies from the Podfile and 6 total pods installed.
nixs@nixs-iMac Example % ping www.baidu.com
PING www.a.shifen.com (61.135.185.32): 56 data bytes
64 bytes from 61.135.185.32: icmp_seq=0 ttl=55 time=16.798 ms
64 bytes from 61.135.185.32: icmp_seq=1 ttl=55 time=37.389 ms
^C
--- www.a.shifen.com ping statistics ---
3 packets transmitted, 2 packets received, 33.3% packet loss
round-trip min/avg/max/stddev = 16.798/27.093/37.389/10.296 ms
nixs@nixs-iMac Example % ls
Podfile				Pods				mydemoprinttest			mydemoprinttest.xcworkspace
Podfile.lock			Tests				mydemoprinttest.xcodeproj
nixs@nixs-iMac Example % pod update --no-repo-update
Update all pods
Analyzing dependencies
Downloading dependencies
Installing mydemoprinttest 0.1.0
Generating Pods project
Integrating client project
Pod installation complete! There are 4 dependencies from the Podfile and 6 total pods installed.
nixs@nixs-iMac Example % pod lib lint

[!] Unable to find a podspec in the working directory
nixs@nixs-iMac Example % ls
Podfile				Pods				mydemoprinttest			mydemoprinttest.xcworkspace
Podfile.lock			Tests				mydemoprinttest.xcodeproj
nixs@nixs-iMac Example % cd ..
nixs@nixs-iMac mydemoprinttest % ls
Example			LICENSE			README.md		_Pods.xcodeproj		mydemoprinttest		mydemoprinttest.podspec
nixs@nixs-iMac mydemoprinttest % pod lib lint

 -> mydemoprinttest (0.1.0)
    - WARN  | summary: The summary is not meaningful.
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'mydemoprinttest' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'Pods-App' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'App' from project 'App')
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')

[!] mydemoprinttest did not pass validation, due to 1 warning (but you can use `--allow-warnings` to ignore it).
You can use the `--no-clean` option to inspect any issue.
nixs@nixs-iMac mydemoprinttest % pod lib lint --allow-warnings

 -> mydemoprinttest (0.1.0)
    - WARN  | summary: The summary is not meaningful.
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'mydemoprinttest' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'Pods-App' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'App' from project 'App')

mydemoprinttest passed validation.
nixs@nixs-iMac mydemoprinttest % ls
Example			LICENSE			README.md		_Pods.xcodeproj		mydemoprinttest		mydemoprinttest.podspec
nixs@nixs-iMac mydemoprinttest % pwd
/Users/nixs/Documents/docker/iOS_public/mydemoprinttest
nixs@nixs-iMac mydemoprinttest % git add .
nixs@nixs-iMac mydemoprinttest % git add *
nixs@nixs-iMac mydemoprinttest % git commit -a -m '第一次提交 tag:0.0.1'
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
nixs@nixs-iMac mydemoprinttest % git push origin master
Everything up-to-date
nixs@nixs-iMac mydemoprinttest % git tag 0.0.1
nixs@nixs-iMac mydemoprinttest % git push origin 0.0.1
Total 0 (delta 0), reused 0 (delta 0)
To http://localhost:81/ios_private/mydemoprinttest.git
 * [new tag]         0.0.1 -> 0.0.1
nixs@nixs-iMac mydemoprinttest % ls
Example			LICENSE			README.md		_Pods.xcodeproj		mydemoprinttest		mydemoprinttest.podspec
nixs@nixs-iMac mydemoprinttest % pod repo add MyPrivateSpecs http://localhost:81/ios_private/my_specs.git
Cloning spec repo `MyPrivateSpecs` from `http://localhost:81/ios_private/my_specs.git`
nixs@nixs-iMac mydemoprinttest % ls
Example			LICENSE			README.md		_Pods.xcodeproj		mydemoprinttest		mydemoprinttest.podspec
nixs@nixs-iMac mydemoprinttest %
nixs@nixs-iMac mydemoprinttest % ls -la
total 56
drwxr-xr-x@ 12 nixs  staff   384  8 25 14:29 .
drwxr-xr-x@  7 nixs  staff   224  8 25 10:10 ..
-rw-r--r--@  1 nixs  staff  6148  8 25 10:09 .DS_Store
drwxr-xr-x  15 nixs  staff   480  8 25 14:36 .git
-rw-r--r--@  1 nixs  staff   738  8 25 10:08 .gitignore
-rw-r--r--@  1 nixs  staff   561  8 25 10:09 .travis.yml
drwxr-xr-x@ 10 nixs  staff   320  8 25 10:32 Example
-rw-r--r--@  1 nixs  staff  1081  8 25 10:09 LICENSE
-rw-r--r--   1 nixs  staff  1012  8 25 10:09 README.md
lrwxr-xr-x   1 nixs  staff    27  8 25 10:09 _Pods.xcodeproj -> Example/Pods/Pods.xcodeproj
drwxr-xr-x   4 nixs  staff   128  8 25 10:08 mydemoprinttest
-rw-r--r--@  1 nixs  staff  1649  8 25 14:29 mydemoprinttest.podspec
nixs@nixs-iMac mydemoprinttest % pod repo push MyPrivateSpecs mydemoprinttest.podspec

Validating spec
 -> mydemoprinttest (0.1.0)
    - WARN  | summary: The summary is not meaningful.
    - ERROR | [iOS] unknown: Encountered an unknown error ([!] /usr/bin/git clone http://localhost:81/ios_private/mydemoprinttest.git /var/folders/nb/y4jv4vkn4yv7nxwl4957cwb80000gp/T/d20200825-24104-rabkje --template= --single-branch --depth 1 --branch 0.1.0

Cloning into '/var/folders/nb/y4jv4vkn4yv7nxwl4957cwb80000gp/T/d20200825-24104-rabkje'...
warning: Could not find remote branch 0.1.0 to clone.
fatal: Remote branch 0.1.0 not found in upstream origin
) during validation.

[!] The `mydemoprinttest.podspec` specification does not validate.
nixs@nixs-iMac mydemoprinttest % git tag 0.1.0
nixs@nixs-iMac mydemoprinttest % git push origin 0.1.0
Total 0 (delta 0), reused 0 (delta 0)
To http://localhost:81/ios_private/mydemoprinttest.git
 * [new tag]         0.1.0 -> 0.1.0
nixs@nixs-iMac mydemoprinttest % ls
Example			LICENSE			README.md		_Pods.xcodeproj		mydemoprinttest		mydemoprinttest.podspec
nixs@nixs-iMac mydemoprinttest % pod repo push MyPrivateSpecs mydemoprinttest.podspec

Validating spec
 -> mydemoprinttest (0.1.0)
    - WARN  | summary: The summary is not meaningful.
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'mydemoprinttest' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'Pods-App' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'App' from project 'App')

[!] The `mydemoprinttest.podspec` specification does not validate.
nixs@nixs-iMac mydemoprinttest % pod repo push MyPrivateSpecs mydemoprinttest.podspec --allow-warnings

Validating spec
 -> mydemoprinttest (0.1.0)
    - WARN  | summary: The summary is not meaningful.
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'mydemoprinttest' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'Pods-App' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'App' from project 'App')
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')

Updating the `MyPrivateSpecs' repo


Adding the spec to the `MyPrivateSpecs' repo

 - [Add] mydemoprinttest (0.1.0)

Pushing the `MyPrivateSpecs' repo

nixs@nixs-iMac mydemoprinttest % ls
Example			LICENSE			README.md		_Pods.xcodeproj		mydemoprinttest		mydemoprinttest.podspec
nixs@nixs-iMac mydemoprinttest % cd Example
nixs@nixs-iMac Example % pod install --no-repo-update
Analyzing dependencies
[!] Unable to find a specification for `mydemoprinttest`

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

nixs@nixs-iMac Example % pod repo update
Updating spec repo `artsy`
Updating spec repo `master`
  $ /usr/bin/git -C /Users/nixs/.cocoapods/repos/master fetch origin --progress



  remote: Enumerating objects: 9217, done.
  remote: Counting objects: 100% (9217/9217), done.
  remote: Compressing objects: 100% (132/132), done.
  remote: Total 21234 (delta 9117), reused 9082 (delta 9082), pack-reused 12017
  Receiving objects: 100% (21234/21234), 2.27 MiB | 8.00 KiB/s, done.
  Resolving deltas: 100% (14966/14966), completed with 2754 local objects.
  From https://github.com/CocoaPods/Specs
     b7873f978d59..e71394ae9cb5  master     -> origin/master
  $ /usr/bin/git -C /Users/nixs/.cocoapods/repos/master rev-parse --abbrev-ref HEAD
  master
  $ /usr/bin/git -C /Users/nixs/.cocoapods/repos/master reset --hard origin/master
  Checking out files: 100% (2287/2287), done.
  HEAD is now at e71394ae9cb5 [Add] DzyImagePicker 1.1.3
Updating spec repo `MyPrivateSpecs`
  $ /usr/bin/git -C /Users/nixs/.cocoapods/repos/MyPrivateSpecs fetch origin --progress
  $ /usr/bin/git -C /Users/nixs/.cocoapods/repos/MyPrivateSpecs rev-parse --abbrev-ref HEAD
  master
  $ /usr/bin/git -C /Users/nixs/.cocoapods/repos/MyPrivateSpecs reset --hard origin/master
  HEAD is now at 104562d [Add] mydemoprinttest (0.1.0)
Updating spec repo `trunk`

CocoaPods 1.10.0.beta.2 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.10.0.beta.2

nixs@nixs-iMac Example %
nixs@nixs-iMac Example %
nixs@nixs-iMac Example %
nixs@nixs-iMac Example % ls
Podfile				Pods				mydemoprinttest			mydemoprinttest.xcworkspace
Podfile.lock			Tests				mydemoprinttest.xcodeproj
nixs@nixs-iMac Example % pod install
Analyzing dependencies
[!] Unable to find a specification for `mydemoprinttest`

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

nixs@nixs-iMac Example % cat Podfile
use_frameworks!

platform :ios, '8.0'

target 'mydemoprinttest_Example' do
  #pod 'mydemoprinttest', :path => '../'
  pod 'Masonry'
  pod 'NITools'
  pod 'mydemoprinttest'

  target 'mydemoprinttest_Tests' do
    inherit! :search_paths

    pod 'FBSnapshotTestCase'
  end
end
nixs@nixs-iMac Example % pod install --repo-update
Updating local specs repositories

CocoaPods 1.10.0.beta.2 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.10.0.beta.2

Analyzing dependencies
[!] Unable to find a specification for `mydemoprinttest`

You have either:
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

nixs@nixs-iMac Example % pod install --repo-update
Updating local specs repositories
  $ /usr/bin/git -C /Users/nixs/.cocoapods/repos/MyPrivateSpecs fetch origin --progress
  $ /usr/bin/git -C /Users/nixs/.cocoapods/repos/MyPrivateSpecs rev-parse --abbrev-ref HEAD
  master
  $ /usr/bin/git -C /Users/nixs/.cocoapods/repos/MyPrivateSpecs reset --hard origin/master
  HEAD is now at 104562d [Add] mydemoprinttest (0.1.0)
[!] Failed to connect to GitHub to update the CocoaPods/Specs specs repo - Please check if you are offline, or that GitHub is down
nixs@nixs-iMac Example % git config --global http.proxy
nixs@nixs-iMac Example % git config --global --unset http.proxy
nixs@nixs-iMac Example % ls
Podfile				Pods				mydemoprinttest			mydemoprinttest.xcworkspace
Podfile.lock			Tests				mydemoprinttest.xcodeproj
nixs@nixs-iMac Example % pod install
Analyzing dependencies
Downloading dependencies
Installing mydemoprinttest (0.1.0)
Generating Pods project
Integrating client project
Pod installation complete! There are 4 dependencies from the Podfile and 6 total pods installed.
nixs@nixs-iMac Example % ls
Podfile				Pods				mydemoprinttest			mydemoprinttest.xcworkspace
Podfile.lock			Tests				mydemoprinttest.xcodeproj
nixs@nixs-iMac Example % pod install
Analyzing dependencies
Downloading dependencies
Installing mydemoprinttest 0.2.0 (was 0.1.0)
Generating Pods project
Integrating client project
Pod installation complete! There are 4 dependencies from the Podfile and 6 total pods installed.
nixs@nixs-iMac Example % ls
Podfile				Pods				mydemoprinttest			mydemoprinttest.xcworkspace
Podfile.lock			Tests				mydemoprinttest.xcodeproj
nixs@nixs-iMac Example % cd ..
nixs@nixs-iMac mydemoprinttest % ls
Example			LICENSE			README.md		_Pods.xcodeproj		mydemoprinttest		mydemoprinttest.podspec
nixs@nixs-iMac mydemoprinttest % cat mydemoprinttest.podspec
#
# Be sure to run `pod lib lint mydemoprinttest.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
  s.name             = 'mydemoprinttest'
  s.version          = '0.2.0'
  s.summary          = 'tag:0.2.0版本更新'

# This description is used to generate tags and improve search results.
#   * Think: What does it do? Why did you write it? What is the focus?
#   * Try to keep it short, snappy and to the point.
#   * Write the description between the DESC delimiters below.
#   * Finally, don't worry about the indent, CocoaPods strips it!

  s.description      = <<-DESC
TODO: Add long description of the pod here.
                       DESC

  s.homepage         = 'http://localhost:81/ios_private/mydemoprinttest'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { '1911398892@qq.com' => '1911398892@qq.com' }
  s.source           = { :git => 'http://localhost:81/ios_private/mydemoprinttest.git', :tag => s.version.to_s }
  # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  s.ios.deployment_target = '8.0'

  s.source_files = 'mydemoprinttest/Classes/**/*'

  # s.resource_bundles = {
  #   'mydemoprinttest' => ['mydemoprinttest/Assets/*.png']
  # }

  # s.public_header_files = 'Pod/Classes/**/*.h'
  # s.frameworks = 'UIKit', 'MapKit'
  # s.dependency 'AFNetworking', '~> 2.3'
end
nixs@nixs-iMac mydemoprinttest % pod repo push MyPrivateSpecs mydemoprinttest.podspec --allow-warnings

Validating spec
 -> mydemoprinttest (0.2.0)
    - ERROR | [iOS] unknown: Encountered an unknown error ([!] /usr/bin/git clone http://localhost:81/ios_private/mydemoprinttest.git /var/folders/nb/y4jv4vkn4yv7nxwl4957cwb80000gp/T/d20200825-42041-1dovwop --template= --single-branch --depth 1 --branch 0.2.0

Cloning into '/var/folders/nb/y4jv4vkn4yv7nxwl4957cwb80000gp/T/d20200825-42041-1dovwop'...
warning: Could not find remote branch 0.2.0 to clone.
fatal: Remote branch 0.2.0 not found in upstream origin
) during validation.

[!] The `mydemoprinttest.podspec` specification does not validate.
nixs@nixs-iMac mydemoprinttest % git add .
nixs@nixs-iMac mydemoprinttest % git commit -a -m 'tag:0.2.0'
[1-引用本地开发仓库lib be95f8d] tag:0.2.0
 6 files changed, 11 insertions(+), 11 deletions(-)
nixs@nixs-iMac mydemoprinttest % git push -u origin master
Branch 'master' set up to track remote branch 'master' from 'origin'.
Everything up-to-date
nixs@nixs-iMac mydemoprinttest % git tag 0.2.0
nixs@nixs-iMac mydemoprinttest % git push origin 0.2.0
Enumerating objects: 27, done.
Counting objects: 100% (27/27), done.
Delta compression using up to 4 threads
Compressing objects: 100% (14/14), done.
Writing objects: 100% (14/14), 1.27 KiB | 1.27 MiB/s, done.
Total 14 (delta 9), reused 0 (delta 0)
To http://localhost:81/ios_private/mydemoprinttest.git
 * [new tag]         0.2.0 -> 0.2.0
nixs@nixs-iMac mydemoprinttest % ls
Example			LICENSE			README.md		_Pods.xcodeproj		mydemoprinttest		mydemoprinttest.podspec
nixs@nixs-iMac mydemoprinttest % pod lib lint --allow-warnings

 -> mydemoprinttest (0.2.0)
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'mydemoprinttest' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'Pods-App' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'App' from project 'App')
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')

mydemoprinttest passed validation.
nixs@nixs-iMac mydemoprinttest % pod repo push MyPrivateSpecs mydemoprinttest.podspec --allow-warnings

Validating spec
 -> mydemoprinttest (0.2.0)
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'mydemoprinttest' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'Pods-App' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'App' from project 'App')

Updating the `MyPrivateSpecs' repo


Adding the spec to the `MyPrivateSpecs' repo

 - [Update] mydemoprinttest (0.2.0)

Pushing the `MyPrivateSpecs' repo

nixs@nixs-iMac mydemoprinttest % ls
Example			LICENSE			README.md		_Pods.xcodeproj		mydemoprinttest		mydemoprinttest.podspec
nixs@nixs-iMac mydemoprinttest % cd Example
nixs@nixs-iMac Example % ls
Podfile				Pods				mydemoprinttest			mydemoprinttest.xcworkspace
Podfile.lock			Tests				mydemoprinttest.xcodeproj
nixs@nixs-iMac Example % pod install
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 4 dependencies from the Podfile and 6 total pods installed.
nixs@nixs-iMac Example % pod install
Analyzing dependencies
[!] Unable to find a specification for `MyDemoPrintTest (~> 0.2.0)`

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

nixs@nixs-iMac Example % pod repo update
Updating spec repo `artsy`
[!] Failed to connect to GitHub to update the Artsy/Specs specs repo - Please check if you are offline, or that GitHub is down
nixs@nixs-iMac Example % pod repo update
Updating spec repo `artsy`
[!] Failed to connect to GitHub to update the Artsy/Specs specs repo - Please check if you are offline, or that GitHub is down
nixs@nixs-iMac Example % git config --global http.proxy
nixs@nixs-iMac Example % git config --global --unset http.proxy
nixs@nixs-iMac Example % pod repo update
Updating spec repo `artsy`
[!] Failed to connect to GitHub to update the Artsy/Specs specs repo - Please check if you are offline, or that GitHub is down
nixs@nixs-iMac Example % ls
Podfile				Pods				mydemoprinttest			mydemoprinttest.xcworkspace
Podfile.lock			Tests				mydemoprinttest.xcodeproj
nixs@nixs-iMac Example % pod repo update
Updating spec repo `artsy`
[!] Failed to connect to GitHub to update the Artsy/Specs specs repo - Please check if you are offline, or that GitHub is down
nixs@nixs-iMac Example % pod update --verbose --no-repo-update
Update all pods
  Preparing

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-mydemoprinttest_Example`: (``)
  Using `ARCHS` setting to build architectures of target `Pods-mydemoprinttest_Tests`: (``)

Finding Podfile changes
  A MyDemoPrintTest
  R mydemoprinttest
  - FBSnapshotTestCase
  - Masonry
  - NITools

Resolving dependencies of `Podfile`
  CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
[!] Unable to find a specification for `MyDemoPrintTest (~> 0.2.0)`

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.


/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:389:in `find_cached_set'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:360:in `specifications_for_dependency'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:165:in `search_for'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:274:in `block in sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:267:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:267:in `sort_by'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:267:in `sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:53:in `block in sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:70:in `with_no_such_dependency_error_handling'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:52:in `sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:288:in `initial_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:210:in `start_resolution'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:168:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:94:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/installer/analyzer.rb:1065:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/installer/analyzer.rb:1063:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/command/update.rb:63:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
nixs@nixs-iMac Example % pod install
Analyzing dependencies
[!] Unable to find a specification for `MyDemoPrintTest (~> 0.2.0)`

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

nixs@nixs-iMac Example % pod repo update
Updating spec repo `artsy`
Updating spec repo `master`
  $ /usr/bin/git -C /Users/nixs/.cocoapods/repos/master fetch origin --progress


  remote: Enumerating objects: 140, done.
  remote: Counting objects: 100% (140/140), done.
  remote: Compressing objects: 100% (96/96), done.
  remote: Total 99 (delta 60), reused 0 (delta 0), pack-reused 0
  From https://github.com/CocoaPods/Specs
     e71394ae9cb5..ccf2eddb41be  master     -> origin/master
  $ /usr/bin/git -C /Users/nixs/.cocoapods/repos/master rev-parse --abbrev-ref HEAD
  master
  $ /usr/bin/git -C /Users/nixs/.cocoapods/repos/master reset --hard origin/master
  HEAD is now at ccf2eddb41be [Add] DDRouter 0.5.0
Updating spec repo `MyPrivateSpecs`
  $ /usr/bin/git -C /Users/nixs/.cocoapods/repos/MyPrivateSpecs fetch origin --progress
  $ /usr/bin/git -C /Users/nixs/.cocoapods/repos/MyPrivateSpecs rev-parse --abbrev-ref HEAD
  master
  $ /usr/bin/git -C /Users/nixs/.cocoapods/repos/MyPrivateSpecs reset --hard origin/master
  HEAD is now at 9aa1180 [Update] mydemoprinttest (0.2.0)
Updating spec repo `trunk`

CocoaPods 1.10.0.beta.2 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.10.0.beta.2

nixs@nixs-iMac Example %
nixs@nixs-iMac Example %
nixs@nixs-iMac Example % ls
Podfile				Pods				mydemoprinttest			mydemoprinttest.xcworkspace
Podfile.lock			Tests				mydemoprinttest.xcodeproj
nixs@nixs-iMac Example % pod install
Analyzing dependencies
[!] Unable to find a specification for `MyDemoPrintTest (~> 0.2.0)`

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

nixs@nixs-iMac Example % pod install
Analyzing dependencies
Downloading dependencies
Installing mydemoprinttest 0.2.0 (was 0.1.0)
Generating Pods project
Integrating client project
Pod installation complete! There are 4 dependencies from the Podfile and 6 total pods installed.
nixs@nixs-iMac Example %

引用私有库Podfile示例 如下:

# 如下是索引库地址
source 'http://localhost:81/ios_private/my_specs.git'
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/Artsy/Specs.git'

platform :ios, '8.0'
# 引用框架
use_frameworks!
# ignore all warnings from all pods(注解)
inhibit_all_warnings!

target 'mydemoprinttest_Example' do
  #pod 'mydemoprinttest', :path => '../'
  pod 'Masonry'
  pod 'NITools'
  pod 'mydemoprinttest', '~> 0.2.0'
  
  target 'mydemoprinttest_Tests' do
    inherit! :search_paths

    pod 'FBSnapshotTestCase'
  end
end

如还有疑问微信联系 (注明来意)我微信号:wvqusrtg
-详细资料在我有道云笔记

标签:mydemoprinttest,nixs,私有,iMac,repo,--,Cocoapods,Example,搭建
来源: https://blog.51cto.com/u_4955660/2866348