LoginSignup
8
2

More than 5 years have passed since last update.

デバッグツールSonarをiOSで導入するときに引っかかったところ

Last updated at Posted at 2018-06-14

基本事項

macOS 10.13.4
Xcode9.4
CocoaPods 1.5.2

公式ドキュメント

pod installで引っかかる

ドキュメント内のライブラリ一覧のURLが404

ドキュメントに始め方が書いてあり、podで入れればいいと書いてありますが、

platform :ios, '8.0'
swift_version = '4.1'

target 'MyApp' do

  pod 'RSocket', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/master/iOS/third-party-podspecs/RSocket.podspec?token=ADr9NE_I05Vu8g7oq_g6g_9FLx784NFmks5bJ5LvwA%3D%3D'
  pod 'DoubleConversion', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/master/iOS/third-party-podspecs/DoubleConversion.podspec?token=ADr9NOxtIEmr5ODP9PWq6-sht-Ye6UYGks5bJ5MjwA%3D%3D'
  pod 'glog', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/master/iOS/third-party-podspecs/glog.podspec?token=ADr9NBHbrlbkFR3DQTPzj0CnZdria4jvks5bJ5M3wA%3D%3D'
  pod 'Folly', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/master/iOS/third-party-podspecs/Folly.podspec?token=ADr9NNTjwJ8xqLFwc3Qz3xB3GsCk-Esmks5bJ5NGwA%3D%3D'
  pod 'PeerTalk', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/master/iOS/third-party-podspecs/PeerTalk.podspec?token=ADr9NB8frQTrUWytsMXtdv_P8km7jV_Mks5bJ5NbwA%3D%3D'
  pod 'Yoga','~>1.8.1', :modular_headers => true
  pod 'Sonar', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/master/xplat/Sonar/Sonar.podspec?token=ADr9NFO7byH9uAuhGAIEYuoJeBNyBxf6ks5bJ5N8wA%3D%3D'
  pod 'SonarKit', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/master/SonarKit.podspec?token=ADr9NBuYoodM_NeysQg899hkxXw0WZ7Xks5bJ5OVwA%3D%3D'
  pod 'SonarKit/SonarKitLayoutComponentKitSupport', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/master/SonarKit.podspec?token=ADr9NBuYoodM_NeysQg899hkxXw0WZ7Xks5bJ5OVwA%3D%3D'
  pod 'SonarKit/SKIOSNetworkPlugin', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/master/SonarKit.podspec?token=ADr9NBuYoodM_NeysQg899hkxXw0WZ7Xks5bJ5OVwA%3D%3D'
  pod 'ComponentKit', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/master/iOS/third-party-podspecs/ComponentKit.podspec?token=ADr9NNV9gqkpFTUKaHpCiYOZIG3Ev-Hyks5bJ5O-wA%3D%3D'
  post_install do |installer|
        installer.pods_project.targets.each do |target|
            if ['YogaKit'].include? target.name
                target.build_configurations.each do |config|
                    config.build_settings['SWIFT_VERSION'] = swift_version
                end
            end
        end
    end
end

SonarKitSonarKit/SonarKitLayoutComponentKitSupportSonarKit/SKIOSNetworkPluginがこのような404のエラーを吐きます

[!] Failed to fetch podspec for `SonarKit` at `https://raw.githubusercontent.com/facebook/Sonar/master/SonarKit.podspec?token=ADr9NBuYoodM_NeysQg899hkxXw0WZ7Xks5bJ5OVwA%3D%3D`.
 Error: 404 Not Found

修正方法

公式gitに修正プルリクがあがってました
https://github.com/facebook/Sonar/issues/66

platform :ios, '9.0'
swift_version = "4.1"

target 'demo' do
  pod 'RSocket', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/Fix-Broken-iOS-OSS/iOS/third-party-podspecs/RSocket.podspec'
  pod 'DoubleConversion', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/Fix-Broken-iOS-OSS/iOS/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/Fix-Broken-iOS-OSS/iOS/third-party-podspecs/glog.podspec'
  # pod 'CocoaLibEvent', '~> 1.0'
  #:podspec => 'https://raw.githubusercontent.com/facebook/Sonar/master/iOS/third-party-podspecs/glog.podspec?token=ADr9NImskgi8eZGAADCQH2_PXtgB7-b-ks5bIDrowA%3D%3D'
  pod 'Folly', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/Fix-Broken-iOS-OSS/iOS/third-party-podspecs/Folly.podspec'
  pod 'PeerTalk', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/Fix-Broken-iOS-OSS/iOS/third-party-podspecs/PeerTalk.podspec'
  pod 'Yoga','~>1.8.1', :modular_headers => true
  pod 'Sonar', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/Fix-Broken-iOS-OSS/xplat/Sonar/Sonar.podspec'
  pod 'SonarKit', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/Fix-Broken-iOS-OSS/iOS/SonarKit.podspec'
  pod 'SonarKit/SonarKitLayoutComponentKitSupport', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/Fix-Broken-iOS-OSS/iOS/SonarKit.podspec'
  pod 'SonarKit/SKIOSNetworkPlugin', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/Fix-Broken-iOS-OSS/iOS/SonarKit.podspec'
  pod 'ComponentKit', :podspec => 'https://raw.githubusercontent.com/facebook/Sonar/Fix-Broken-iOS-OSS/iOS/third-party-podspecs/ComponentKit.podspec'
  post_install do |installer|
        installer.pods_project.targets.each do |target|
            if ['YogaKit'].include? target.name
                target.build_configurations.each do |config|
                    config.build_settings['SWIFT_VERSION'] = swift_version
                end
            end
        end
    end

end

自分の入れてたCocoaPodsのバージョンが低くて引っかかる

CocoaPodsバージョン1.2.0をいれていました

このようなエラーが出ていました

$ bundle exec pod install
[!] A dependency with an external source may not specify version requirements (Yoga).

podfileを編集してYoga以外をいれようとすると下記のようなエラーが出てきました

$ bundle exec pod install
[!] Invalid `SonarKit.podspec` file: undefined method `static_framework=' for #<Pod::Specification name="SonarKit">
Did you mean?  weak_framework=.

 #  from SonarKit.podspec:12
 #  -------------------------------------------
 #    spec.authors = 'Facebook'
 >    spec.static_framework = true
 #    spec.source = { :git => 'https://github.com/facebook/Sonar.git',
 #  -------------------------------------------

CocoaPodsバージョンを最新の1.5.2にあげると無事にワークスペースが作られました

8
2
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
8
2