Home > Software design >  `warn_for_unused_master_specs_repo => false` causes syntax errors
`warn_for_unused_master_specs_repo => false` causes syntax errors

Time:02-19

Recently I've been working on two iOS projects. One of them has source commands in the Podfile, and the other doesn't. The Podfile for the latter looks something like this:

platform :ios, '12.0'

target 'MyApp' do
  use_frameworks!

  pod 'Foo', '~> 1.2'
  pod 'Bar', '~> 5.4'
  # ...etc
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
    end
  end
end

Whenever I run pod install for that project, I get a warning about an unused master specs repo, but it says to add warn_for_unused_master_specs_repo => false to disable the warning. So I do:

platform :ios, '12.0'

warn_for_unused_master_specs_repo => false # this is new

# ...

Now, I get a syntax error when I try to pod install. I don't know Ruby, so I can't diagnose the problem myself very well.

I already found "Your project does not explicitly specify the CocoaPods master specs repo" warning when running pod install. The accepted answer says to remove the master specs repo, which isn't a viable solution in my case -- like I said at the beginning, I'm working on another project which specifies source, and whenever I run pod install there the warning will just come back.

I also found that :warn_for_unused_master_specs_repo (with a colon) is an option for the install! command, which might look like this:

install! 'cocoapods', :warn_for_unused_master_specs_repo => false

but I don't currently have an install! command, and I'm not sure what the consequences of adding one would be. (Google has been unhelpful here, as the results are more about the pod install shell command than the install! Ruby command.)

Why does the warning suggest something that isn't allowed, and what should I do?

CodePudding user response:

Use install! 'cocoapods', :warn_for_unused_master_specs_repo => false

An empty install! 'cocoapods' command is implicit for any Podfile. More info in the Podfile guide.

  • Related