質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%

Q&A

解決済

1回答

1486閲覧

CocoaPodsにてローカル・外部ライブラリが同時にインストールできない

hkawai

総合スコア4

0グッド

0クリップ

投稿2020/01/12 06:48

編集2020/01/12 07:47

前提・実現したいこと

下記記事の状況より、調べながら作業を進める中でのご質問となります。
タイトル【他人のXcodeプロジェクトを開くとエラーが発生し正常に開かない】
https://teratail.com/questions/234503

表題の通り、ローカル・外部のライブラリのインストールしたいのですが、
うまくいかない為、解決策を教えて頂きたく存じます。

状況としまして、他人のPodfile元データをそのままpod installにて実行すると
ローカルのライブラリのインストールの際?にエラーとなってしまう為、Podfile内容の
書き換えを行い、外部→ローカルと2回に分けてインストールの実行をしました。

すると、2回目のインストール実行の際、1回目にインストールされた外部ライブラリが
何故か削除されてしまう為、解決策を教えて頂ければ幸いです。

元のPodfile内容

# Uncomment the next line to define a global platform for your project # platform :ios, '9.0' platform :ios, '11.0' project 'FSLiPad.xcodeproj' target 'FSLiPad' do # Comment the next line if you're not using Swift and don't want to use dynamic frameworks source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Specs.git' use_frameworks! pod 'SalesforceSDKCommon' pod 'SalesforceAnalytics' pod 'SalesforceSDKCore' pod 'SmartStore' pod 'SmartSync' pod 'RealmSwift' pod 'FSCalendar' pod 'MBProgressHUD', '~> 1.1.0' pod 'DeployGateSDK' end # Comment the following if you do not want the SDK to emit signpost events for instrumentation. Signposts are enabled for non release version of the app. post_install do |installer_representation| installer_representation.pods_project.targets.each do |target| target.build_configurations.each do |config| if config.name == 'Debug' config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'DEBUG=1','SIGNPOST_ENABLED=1'] config.build_settings['OTHER_SWIFT_FLAGS'] = ['$(inherited)', '-DDEBUG','-DSIGNPOST_ENABLED'] end end end end

元データの状態で発生するエラーメッセージ

[!] Unable to find a specification for `RealmSwift` 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.

上記のように元データのまま、pod installを行うとエラーとなる為、
次のようにPodfile内容の書き換えを行い、2分割に分けて実行しました。

分割1回目

podfile

1# Uncomment the next line to define a global platform for your project 2# platform :ios, '9.0' 3platform :ios, '11.0' 4project 'FSLiPad.xcodeproj' 5 6target 'FSLiPad' do 7 # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 8 source 'https://github.com/CocoaPods/Specs.git' 9source 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Specs.git' 10 11use_frameworks! 12 13pod 'SalesforceSDKCommon' 14pod 'SalesforceAnalytics' 15pod 'SalesforceSDKCore' 16 17end 18 19# Comment the following if you do not want the SDK to emit signpost events for instrumentation. Signposts are enabled for non release version of the app. 20 post_install do |installer_representation| 21 installer_representation.pods_project.targets.each do |target| 22 target.build_configurations.each do |config| 23 if config.name == 'Debug' 24 config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'DEBUG=1','SIGNPOST_ENABLED=1'] 25 config.build_settings['OTHER_SWIFT_FLAGS'] = ['$(inherited)', '-DDEBUG','-DSIGNPOST_ENABLED'] 26 end 27 end 28 end 29 end

pod 'SmartStore'
pod 'SmartSync'
上記2つのライブラリは、下記記事を確認したところSalesforceSDKCoreと
連動するため、pod宣言する必要がないとわかりました。
https://trailhead.salesforce.com/ja/content/learn/modules/mobile_sdk_native_ios/mobilesdk_ios_cocoapods

install

1Installing SalesforceAnalytics (7.3.0) 2Installing SalesforceSDKCommon (7.3.0) 3Installing SalesforceSDKCore (7.3.0) 4Generating Pods project 5Integrating client project 6Pod installation complete! There are 3 dependencies from the Podfile and 3 total pods installed.

分割2回目

podfile

1# Uncomment the next line to define a global platform for your project 2# platform :ios, '9.0' 3platform :ios, '11.0' 4 5target 'FSLiPad' do 6 # Comment the next line if you're not using Swift and don't want to use dynamic 7pod 'RealmSwift', '~> 3.17', :modular_headers => true 8pod 'Realm', '~> 3.17', :modular_headers => true 9pod 'FSCalendar' 10pod 'MBProgressHUD', '~> 1.1.0' 11pod 'DeployGateSDK' 12end

pod 'RealmSwift', '> 3.17', :modular_headers => true
pod 'Realm', '
> 3.17', :modular_headers => true
上記2つは下記記事のもの、エラー対応のため書き換えました。
https://tutorialmore.com/questions-258199.htm

install

1Installing DeployGateSDK (1.0.7) 2Installing FSCalendar (2.8.1) 3Installing MBProgressHUD (1.1.0) 4Installing Realm (3.21.0) 5Installing RealmSwift (3.21.0) 6Removing SalesforceAnalytics 7Removing SalesforceSDKCommon 8Removing SalesforceSDKCore 9Generating Pods project 10Integrating client project 11Pod installation complete! There are 5 dependencies from the Podfile and 5 total pods installed.

Removing SalesforceAnalytics
Removing SalesforceSDKCommon
Removing SalesforceSDKCore
上記の通り、先にインストールした外部ライブラリが何故か削除されてしまいました。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

CocoaPodsのmasterをインストールし直し、ローカル→ローカル+外部の順序にてPodfileを編集することでインストールができました。

投稿2020/01/12 09:45

hkawai

総合スコア4

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問