4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

iOSアプリ開発の処方箋 : Unable to find a specification for `AFNetworking (~> 2.0)`.

Last updated at Posted at 2014-09-12

RubyMotion 製の GitHub news feed リーダーアプリ「motion-octofeed」を利用して手を入れつつ勉強しようと
rakeコマンドでiOSシミュレータを起ち上げようとしたら、次のエラーが発生して動きません。

エラー内容

$ rake
================================================================================
A new version of RubyMotion is available. Run `sudo motion update' to upgrade.
================================================================================

rake aborted!
Pod::Informative: [!] Unable to find a specification for `AFNetworking (~> 2.0)`.
/Users/y-ken/Documents/htdocs/motion-octofeed/vendor/bundle/ruby/2.1.0/gems/cocoapods-0.23.0/lib/cocoapods/resolver.rb:195:in `find_cached_set'
/Users/y-ken/Documents/htdocs/motion-octofeed/vendor/bundle/ruby/2.1.0/gems/cocoapods-0.23.0/lib/cocoapods/resolver.rb:153:in `block (2 levels) in find_dependency_specs'

...snip...

解決方法

こんなIssueがありました。
「その問題、pod setupした後にも起きる?」と記載されていたので試してみました。

Unable to find a specification for AFNetworking (~> 2.0.1) in new RM project · Issue #41 · clayallsopp/afmotion
https://github.com/clayallsopp/afmotion/issues/41

そもそも補完入力されないので入ってないようですね。

$ pod
pod2html        pod2latex       pod2man         pod2readme      pod2text        pod2usage       podchecker      podselect
pod2html5.12    pod2latex5.12   pod2man5.12     pod2readme5.12  pod2text5.12    pod2usage5.12   podchecker5.12  podselect5.12
pod2html5.16    pod2latex5.16   pod2man5.16     pod2readme5.16  pod2text5.16    pod2usage5.16   podchecker5.16  podselect5.16

$ pod setup
-bash: pod: command not found

次のページを参考に、 cocoapods を入れてみたいと思います。

開発レシピ:Objective-Cのライブラリ管理ツール CocoaPods | iOS開発者@日本
http://www.iosjp.com/dev/archives/451

ちなみに、Xcodeは閉じた状態で実行した方が良いそうです。
ref. http://amarron.hatenablog.com/entry/2014/04/18/202526

$ gem install cocoapods
Fetching: i18n-0.7.0.beta1.gem (100%)
Successfully installed i18n-0.7.0.beta1
Fetching: multi_json-1.10.1.gem (100%)
Successfully installed multi_json-1.10.1
Fetching: activesupport-3.2.19.gem (100%)
Successfully installed activesupport-3.2.19
Fetching: nap-0.8.0.gem (100%)
Successfully installed nap-0.8.0
Fetching: json_pure-1.8.1.gem (100%)
Successfully installed json_pure-1.8.1
Fetching: fuzzy_match-2.0.4.gem (100%)
Successfully installed fuzzy_match-2.0.4
Fetching: cocoapods-core-0.33.1.gem (100%)
Successfully installed cocoapods-core-0.33.1
Fetching: claide-0.6.1.gem (100%)
Successfully installed claide-0.6.1
Fetching: colored-1.2.gem (100%)
Successfully installed colored-1.2
Fetching: xcodeproj-0.17.0.gem (100%)
Building native extensions.  This could take a while...
Successfully installed xcodeproj-0.17.0
Fetching: cocoapods-downloader-0.6.1.gem (100%)
Successfully installed cocoapods-downloader-0.6.1
Fetching: cocoapods-plugins-0.2.0.gem (100%)
Successfully installed cocoapods-plugins-0.2.0
Fetching: cocoapods-try-0.3.0.gem (100%)
Successfully installed cocoapods-try-0.3.0
Fetching: netrc-0.7.7.gem (100%)
Successfully installed netrc-0.7.7
Fetching: cocoapods-trunk-0.1.4.gem (100%)
Successfully installed cocoapods-trunk-0.1.4
Fetching: escape-0.0.4.gem (100%)
Successfully installed escape-0.0.4
Fetching: open4-1.3.4.gem (100%)
Successfully installed open4-1.3.4
Fetching: cocoapods-0.33.1.gem (100%)

CHANGELOG:

## 0.33.1

##### Bug Fixes

* Fix `pod spec lint` for `json` podspecs.
  [Fabio Pelosin][irrationalfab]
  [#2157](https://github.com/CocoaPods/CocoaPods/issues/2157)

* Fixed downloader issues related to `json` podspecs.
  [Fabio Pelosin][irrationalfab]
  [#2158](https://github.com/CocoaPods/CocoaPods/issues/2158)

* Fixed `--no-ansi` flag in help banners.
  [Fabio Pelosin][irrationalfab]
  [#34](https://github.com/CocoaPods/CLAide/issues/34)

Successfully installed cocoapods-0.33.1
18 gems installed

インストールできたようなので、pod setupを実行してみます。

# 動作確認を兼ねてバージョンを確認
$ pod --version
0.33.1

$ pod setup
Setting up CocoaPods master repo
Setup completed (read-only access)

AFNetworkingのエラーは解消されど、次のようなエラーが発生する場合もあります。

Pod::Informative: [!] The `master` repo requires CocoaPods 0.32.1 -

その際は、指定バージョンのcocoapodsを次のようにインストールしましょう。
Gemfile.lockに新しいバージョンが記述されていると動かないので、
そのファイルを削除の上で、適宜bundle installをやり直しましょう。

$ gem install cocoapods -v 0.32.1
$ rm Gemfile.lock
$ bundle install --path vendor/bundle

どうやら、これで問題は解決したようです。
しかし、rakeコマンドを叩いてiOSシミュレータを起動しようにも、コンパイルが通りません。

次の記事では、その解決法を紹介します。

iOSアプリ開発の処方箋 : RubyMotionでrakeするとNo headers to parseとなりiOSシミュレータが起動しない - Qiita
http://qiita.com/y-ken/items/9587a9ba39bfcb003049

ご参考になれば幸いです。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?