Как подключить AWS SDK к iOS проекту с помощью CocoaPods

Для начала нужно установить CocoaPods:


$ sudo gem install cocoapods

Password:
Fetching: nap-0.8.0.gem (100%)
Successfully installed nap-0.8.0
Fetching: thread_safe-0.3.4.gem (100%)
Successfully installed thread_safe-0.3.4
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: activesupport-4.2.0.gem (100%)
Successfully installed activesupport-4.2.0
Fetching: open4-1.3.4.gem (100%)
Successfully installed open4-1.3.4
Fetching: escape-0.0.4.gem (100%)
Successfully installed escape-0.0.4
Fetching: colored-1.2.gem (100%)
Successfully installed colored-1.2
Fetching: molinillo-0.1.2.gem (100%)
Successfully installed molinillo-0.1.2
Fetching: netrc-0.7.8.gem (100%)
Successfully installed netrc-0.7.8
Fetching: cocoapods-trunk-0.4.1.gem (100%)
Successfully installed cocoapods-trunk-0.4.1
Fetching: cocoapods-try-0.4.3.gem (100%)
Successfully installed cocoapods-try-0.4.3
Fetching: cocoapods-plugins-0.3.2.gem (100%)
Successfully installed cocoapods-plugins-0.3.2
Fetching: cocoapods-downloader-0.8.1.gem (100%)
Successfully installed cocoapods-downloader-0.8.1
Fetching: xcodeproj-0.20.2.gem (100%)
Successfully installed xcodeproj-0.20.2
Fetching: claide-0.7.0.gem (100%)
Successfully installed claide-0.7.0
Fetching: fuzzy_match-2.0.4.gem (100%)
Successfully installed fuzzy_match-2.0.4
Fetching: cocoapods-core-0.35.0.gem (100%)
Successfully installed cocoapods-core-0.35.0
Fetching: cocoapods-0.35.0.gem (100%)
Successfully installed cocoapods-0.35.0
Parsing documentation for nap-0.8.0
Installing ri documentation for nap-0.8.0
Parsing documentation for thread_safe-0.3.4
Installing ri documentation for thread_safe-0.3.4
Parsing documentation for tzinfo-1.2.2
Installing ri documentation for tzinfo-1.2.2
Parsing documentation for i18n-0.7.0
Installing ri documentation for i18n-0.7.0
Parsing documentation for activesupport-4.2.0
Installing ri documentation for activesupport-4.2.0
Parsing documentation for open4-1.3.4
Installing ri documentation for open4-1.3.4
Parsing documentation for escape-0.0.4
Installing ri documentation for escape-0.0.4
Parsing documentation for colored-1.2
Installing ri documentation for colored-1.2
Parsing documentation for molinillo-0.1.2
Installing ri documentation for molinillo-0.1.2
Parsing documentation for netrc-0.7.8
Installing ri documentation for netrc-0.7.8
Parsing documentation for cocoapods-trunk-0.4.1
Installing ri documentation for cocoapods-trunk-0.4.1
Parsing documentation for cocoapods-try-0.4.3
Installing ri documentation for cocoapods-try-0.4.3
Parsing documentation for cocoapods-plugins-0.3.2
Installing ri documentation for cocoapods-plugins-0.3.2
Parsing documentation for cocoapods-downloader-0.8.1
Installing ri documentation for cocoapods-downloader-0.8.1
Parsing documentation for xcodeproj-0.20.2
Installing ri documentation for xcodeproj-0.20.2
Parsing documentation for claide-0.7.0
Installing ri documentation for claide-0.7.0
Parsing documentation for fuzzy_match-2.0.4
Installing ri documentation for fuzzy_match-2.0.4
Parsing documentation for cocoapods-core-0.35.0
Installing ri documentation for cocoapods-core-0.35.0
Parsing documentation for cocoapods-0.35.0
Installing ri documentation for cocoapods-0.35.0
Done installing documentation for nap, thread_safe, tzinfo, i18n, activesupport, open4, escape, colored, molinillo, netrc, cocoapods-trunk, cocoapods-try, cocoapods-plugins, cocoapods-downloader, xcodeproj, claide, fuzzy_match, cocoapods-core, cocoapods after 35 seconds
19 gems installed


Далее переходим в папку с проектом и создаем файл с именем Podfile и таким содержимым:


source 'https://github.com/CocoaPods/Specs.git'

pod "AWSiOSSDKv2"
pod "AWSCognitoSync"


Далее как описывается в руководстве надо дать команду pod install, но у меня возникла ошибка:


$ pod install
Analyzing dependencies
/usr/local/Cellar/ruby/2.2.0/lib/ruby/2.2.0/pathname.rb:430:in `open': No such file or directory @ dir_initialize - ~/.cocoapods/repos (Errno::ENOENT)
    from /usr/local/Cellar/ruby/2.2.0/lib/ruby/2.2.0/pathname.rb:430:in `foreach'
    from /usr/local/Cellar/ruby/2.2.0/lib/ruby/2.2.0/pathname.rb:430:in `children'
    from /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.35.0/lib/cocoapods/sources_manager.rb:63:in `all'
    from /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.35.0/lib/cocoapods/user_interface/error_report.rb:130:in `repo_information'
    from /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.35.0/lib/cocoapods/user_interface/error_report.rb:34:in `report'
    from /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.35.0/lib/cocoapods/command.rb:58:in `report_error'
    from /usr/local/lib/ruby/gems/2.2.0/gems/claide-0.7.0/lib/claide/command.rb:300:in `handle_exception'
    from /usr/local/lib/ruby/gems/2.2.0/gems/claide-0.7.0/lib/claide/command.rb:274:in `rescue in run'
    from /usr/local/lib/ruby/gems/2.2.0/gems/claide-0.7.0/lib/claide/command.rb:264:in `run'
    from /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.35.0/lib/cocoapods/command.rb:45:in `run'
    from /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.35.0/bin/pod:43:in `<top (required)>'
    from /usr/local/bin/pod:23:in `load'
    from /usr/local/bin/pod:23:in `<main>'


Чтобы её исправить надо сначала дать команду pod setup:


$ pod setup
Setting up CocoaPods master repo

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

For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.

Setup completed


А потом снова pod install:


$ pod install
Analyzing dependencies

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

For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.

Downloading dependencies
Installing AWSCognitoSync (1.0.7)
Installing AWSiOSSDKv2 (2.0.15)
Installing Bolts (1.1.3)
Installing FMDB (2.4)
Installing GZIP (1.0.3)
Installing Mantle (1.5.4)
Installing Reachability (3.2)
Installing TMCache (1.2.3)
Installing UICKeyChainStore (1.1.1)
Installing XMLDictionary (1.4)
Generating Pods project
Integrating client project

[!] From now on use `MyProject.xcworkspace`.


Настройка завершена. Для работы с iOS проектом надо теперь открывать .xcworkspace файл.