lonelysoul

Happy share, happy life.

导航

接触CocoaPods遇到的问题

在搜索CocoaPads的教程里,在一个技术blog里看到一句话:现在还不用CocoaPads,我只能说你太low了!因此为了方便第三方库的使用,开始使用CocoaPads;

Google上一搜,很感谢那些无私奉献的大牛们,无论什么样的技术都会有各种的教程以及各种技术笔记供使用者参考;

我搜的第一篇是唐巧的技术blog使用CocoaPods来做iOS程序的包依赖管理,写的很好,不过对于我这种菜鸟还是有很多问题;

于是继续搜索更适合菜鸟的博客,搜到菜鸟安装 CocoaPods,按照来用,打开Terminal,

PS:以下粉色的字是我输入的命令

如下步骤:

MichaeldeMac-mini:~ md004$ sudo gem install cocoapods

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
Building native extensions.  This could take a while...
Building native extensions.  This could take a while...
[!] You are using the prebuilt binary version of the xcodeproj gem.

CHANGELOG:

## 0.28.0
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.27.1...0.28.0)
• [CocoaPods-core](https://github.com/CocoaPods/Core/compare/0.27.1...0.28.0)
• [CLAide](https://github.com/CocoaPods/CLAide/compare/0.3.2...0.4.0)

###### Enhancements

* CLAide now supports gem plugins. An example CocoaPods plugin can be found at
  [open\_pod\_bay](https://github.com/leshill/open_pod_bay).

 \ As of yet there are no promises made yet on the APIs, so try to fail as
  gracefully as possible in case a CocoaPods update breaks your usage. In these
  cases, also please let us know what you would need, so we can take this into
  account when we do finalize APIs.

  [Les Hill](https://github.com/leshill)
  [CLAide#1](https://github.com/CocoaPods/CLAide/pull/1)
 \ [#959](https://github.com/CocoaPods/CocoaPods/issues/959)

###### Bug Fixes

* Compiling `xcassets` with `actool` now uses `UNLOCALIZED_RESOURCES_FOLDER_PATH`
 \ instead of `PRODUCT_NAME.WRAPPER_EXTENSION` as output directory as it is more
 \ accurate and allows the project to overwrite `WRAPPER_NAME`.  
  [Marc Knaup](https://github.com/fluidsonic)
 \ [#1556](https://github.com/CocoaPods/CocoaPods/pull/1556)

* Added a condition to avoid compiling xcassets when `WRAPPER_EXTENSION`
  is undefined, as it would be in the case of static libraries. This prevents
  trying to copy the compiled files to a directory that does not exist.  
  [Noah McCann](https://github.com/nmccann)
 \ [#1521](https://github.com/CocoaPods/CocoaPods/pull/1521)

* Added additional condition to check if `actool` is available when compiling
  `xcassets`. This prevents build failures of Xcode 5 projects on Travis CI (or
  lower Xcode versions).  
 \ [Michal Konturek](https://github.com/michalkonturek)
  [#1511](https://github.com/CocoaPods/CocoaPods/pull/1511)

* Added a condition to properly handle universal or mac apps when compiling
  xcassets. This prevents build errors in the xcassets compilation stage
  particularly when using xctool to build.  
  [Ryan Marsh](https://github.com/ryanwmarsh)
  [#1594](https://github.com/CocoaPods/CocoaPods/pull/1594)

* Vendored Libraries now correctly affect whether a podspec is considered empty.  
 \ [Joshua Kalpin](https://github.com/Kapin)
  [Core#38](https://github.com/CocoaPods/Core/pull/38)

* Vendored Libraries and Vendored Frameworks now have their paths validated correctly. \ 
  [Joshua Kalpin](https://github.com/Kapin)
  [#1567](https://github.com/CocoaPods/CocoaPods/pull/1567)

* Gists are now correctly accepted with https.  
  [Joshua Kalpin](https://github.com/Kapin)
 \ [Core#38](https://github.com/CocoaPods/Core/pull/38)

* The `pod push` command is now more specific about the branch it pushes to.  
  [orta](http://orta.github.io)
 \ [#1561](https://github.com/CocoaPods/CocoaPods/pull/1561)

* Dtrace files are now properly left unflagged when installing, regardless of configuration.  
  [Swizzlr](https://github.com/swizzlr)
 \ [#1560](https://github.com/CocoaPods/CocoaPods/pull/1560)

* Users are now warned if their terminal encoding is not UTF-8. This fixes an issue
  with a small percentage of pod names that are incompatible with ASCII.  
  [Joshua Kalpin](https://github.com/Kapin)
 \ [#1570](https://github.com/CocoaPods/CocoaPods/pull/1570)


Successfully installed i18n-0.6.9
Successfully installed multi_json-1.8.2
Successfully installed activesupport-3.2.16
Successfully installed nap-0.6.0
Successfully installed json-1.8.1
Successfully installed fuzzy_match-2.0.4
Successfully installed cocoapods-core-0.28.0
Successfully installed claide-0.4.0
Successfully installed cocoapods-downloader-0.2.0
Successfully installed rake-10.1.0
Successfully installed colored-1.2
Successfully installed xcodeproj-0.14.1
Successfully installed escape-0.0.4
Successfully installed json_pure-1.8.1
Successfully installed open4-1.3.0
Successfully installed cocoapods-0.28.0
16 gems installed
Installing ri documentation for i18n-0.6.9...
Installing ri documentation for multi_json-1.8.2...
Installing ri documentation for activesupport-3.2.16...

unrecognized option `--encoding'

For help on options, try 'rdoc --help'
MichaeldeMac-mini:~ md004$ pod setup
Setting up CocoaPods master repo
/Library/Ruby/Gems/1.8/gems/cocoapods-0.28.0/lib/cocoapods/executable.rb:55: warning: Insecure world writable dir /Users/md004/Desktop in PATH, mode 040777
/Library/Ruby/Gems/1.8/gems/cocoapods-0.28.0/lib/cocoapods/executable.rb:55: warning: Insecure world writable dir /Users/md004/Desktop in PATH, mode 040777
/Library/Ruby/Gems/1.8/gems/cocoapods-0.28.0/lib/cocoapods/executable.rb:55: warning: Insecure world writable dir /Users/md004/Desktop in PATH, mode 040777
Setup completed (read-only access)

完成了CocoaPods的安装,然后我尝试去搜索一个JSONKit第三方库,如下:

MichaeldeMac-mini:~ md004$ pod search JSONKit


-> JSONKit (1.5pre)
/Library/Ruby/Gems/1.8/gems/cocoapods-0.28.0/lib/cocoapods/user_interface.rb:277: warning: Insecure world writable dir /Users/md004/Desktop in PATH, mode 040777
   A Very High Performance Objective-C JSON Library.
/Library/Ruby/Gems/1.8/gems/cocoapods-0.28.0/lib/cocoapods/user_interface.rb:277: warning: Insecure world writable dir /Users/md004/Desktop in PATH, mode 040777
   pod 'JSONKit', '~> 1.5pre'
/Library/Ruby/Gems/1.8/gems/cocoapods-0.28.0/lib/cocoapods/user_interface.rb:277: warning: Insecure world writable dir /Users/md004/Desktop in PATH, mode 040777
   - Homepage: https://github.com/johnezang/JSONKit
/Library/Ruby/Gems/1.8/gems/cocoapods-0.28.0/lib/cocoapods/user_interface.rb:277: warning: Insecure world writable dir /Users/md004/Desktop in PATH, mode 040777
   - Source:   https://github.com/johnezang/JSONKit.git
/Library/Ruby/Gems/1.8/gems/cocoapods-0.28.0/lib/cocoapods/user_interface.rb:277: warning: Insecure world writable dir /Users/md004/Desktop in PATH, mode 040777
   - Versions: 1.5pre, 1.4 [master repo]

看到了很多警告,很不爽,不知道为什么,悲剧了一会,用中文搜索没搜到结果,果断上Google吧,在Google里直接输入warning: Insecure world writable dir

然后就搜到了StackOverFlow

接着输入命令:

MichaeldeMac-mini:~ md004$ sudo chmod go-w /Users/md004/Desktop
MichaeldeMac-mini:~ md004$ pod search JSONKit


-> JSONKit (1.5pre)
   A Very High Performance Objective-C JSON Library.
   pod 'JSONKit', '~> 1.5pre'
   - Homepage: https://github.com/johnezang/JSONKit
   - Source:   https://github.com/johnezang/JSONKit.git
   - Versions: 1.5pre, 1.4 [master repo]
MichaeldeMac-mini:~ md004$ 

这样就正常了,这里要记住警告Insecure world writable dir /Users/md004/Desktop in PATH, mode 040777,在你要改变权限的时候sudo chmod go-w /Users/md004/Desktop,一定要跟警告处的目录是一样的。

 

 

祝您愉快开心 ^_^

posted on 2013-12-20 10:39  lonelysoul  阅读(1111)  评论(0编辑  收藏  举报