Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError - A key/value pair in the application keychain is nil. #197

Open
mkismy opened this issue Apr 17, 2019 · 7 comments
Open

RuntimeError - A key/value pair in the application keychain is nil. #197

mkismy opened this issue Apr 17, 2019 · 7 comments

Comments

@mkismy
Copy link

mkismy commented Apr 17, 2019

When removing keys from the Podfile, a runtimeerror has occured.

Command

/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/bin/pod update

Report

  • What did you do?
    • Remove keys from Podfile
  • What did you expect to happen?
    • Updated with the key being deleted
  • What happened instead?
    • RuntimeError - A key/value pair in the application keychain is nil.

Stack

   CocoaPods : 1.6.1
        Ruby : ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin18]
    RubyGems : 2.7.6
        Host : Mac OS X 10.14.4 (18E226)
       Xcode : 10.0 (10A255)
         Git : git version 2.11.0
Ruby lib dir : /Users/dev/.rbenv/versions/2.5.1/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 2deaac58ebf43e68153f3bc2bc0b5b629d275cf5

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-keys        : 2.1.0
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.3.1
cocoapods-try         : 1.1.0

Podfile

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

platform :ios, '9.0'
swift_version = '3.0'

def pods
    pod 'AcknowList', '1.2'
    pod 'AdGeneration', '2.13.0'
    pod 'Alamofire', '4.5.1'
    pod 'AppsFlyerFramework', '4.8.9'
    pod 'Compass', '4.0.0'
    pod 'Crashlytics', '3.12.0'
    pod 'Fabric', '1.9.0'
    pod 'Firebase', '5.20.1'
    pod 'Firebase/AdMob'
    pod 'Firebase/Auth'
    pod 'Firebase/DynamicLinks'
    pod 'Firebase/Messaging'
    pod 'Firebase/RemoteConfig'
    pod 'GoogleAnalytics', '3.17.0'
    pod 'GoogleIDFASupport'
    pod 'GoogleTagManager', '~>7.1.1'
    pod 'RealmSwift', '2.10.2'
    pod 'RxSwift', '3.6.1'
    pod 'SDWebImage', '4.4.4'
    pod 'SwiftyUserDefaults', '3.0.0'
    pod 'Unbox', '2.5.0'
end

def testing_pods
    pod 'Nimble', '7.0.2'
    pod 'Quick', '1.2.0'
end

target 'project' do
    use_frameworks!

    pods
    pod 'FBAudienceNetwork'
    pod 'GoogleMobileAdsMediationFacebook', '5.1.0.0'
end

target 'projectTests' do
    use_frameworks!

    pods
    testing_pods
end

post_install do |installer|
    installer.pods_project.build_configurations.each do |config|
        config.build_settings['PROVISIONING_PROFILE_SPECIFIER'] = ''
    end

    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '3.0'
        end
    end
end

plugin 'cocoapods-keys', {
    :project => "project",
    :keys => [
        "AppsFlyerDevKey",
        "AppleAppID",
        "Debug_GoogleAnalyticsTrackingID",
        "Release_GoogleAnalyticsTrackingID",
        "Debug_APIKey",
        "Release_APIKey",
        "Debug_AdMobNativeAdUnitID",
    ]
}

Error

RuntimeError - A key/value pair in the application keychain is nil.
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-keys-2.1.0/lib/key_master.rb:75:in `verify_keychain_integrity'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-keys-2.1.0/lib/key_master.rb:28:in `generate_data'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-keys-2.1.0/lib/key_master.rb:20:in `initialize'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-keys-2.1.0/lib/plugin.rb:39:in `new'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-keys-2.1.0/lib/plugin.rb:39:in `setup'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-keys-2.1.0/lib/plugin.rb:11:in `block in singleton class'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-1.6.1/lib/cocoapods/hooks_manager.rb:122:in `block (3 levels) in run'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-1.6.1/lib/cocoapods/user_interface.rb:145:in `message'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-1.6.1/lib/cocoapods/hooks_manager.rb:116:in `block (2 levels) in run'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-1.6.1/lib/cocoapods/hooks_manager.rb:115:in `each'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-1.6.1/lib/cocoapods/hooks_manager.rb:115:in `block in run'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-1.6.1/lib/cocoapods/user_interface.rb:145:in `message'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-1.6.1/lib/cocoapods/hooks_manager.rb:114:in `run'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:468:in `run_plugins_pre_install_hooks'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:159:in `block in prepare'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-1.6.1/lib/cocoapods/user_interface.rb:145:in `message'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:155:in `prepare'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:135:in `install!'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-1.6.1/lib/cocoapods/command/update.rb:97:in `run'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-1.6.1/lib/cocoapods/command.rb:52:in `run'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/gems/cocoapods-1.6.1/bin/pod:55:in `<top (required)>'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/bin/pod:23:in `load'
/Users/dev/builds/221b080e/0/project/vendor/gems/ruby/2.5.0/bin/pod:23:in `<top (required)>'
/Users/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:74:in `load'
/Users/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:74:in `kernel_load'
/Users/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:28:in `run'
/Users/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/cli.rb:463:in `exec'
/Users/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/Users/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/cli.rb:27:in `dispatch'
/Users/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/Users/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/cli.rb:18:in `start'
/Users/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/exe/bundle:30:in `block in <top (required)>'
/Users/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/Users/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/exe/bundle:22:in `<top (required)>'
/Users/dev/.rbenv/versions/2.5.1/bin/bundle:23:in `load'
/Users/dev/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
@dtrenz
Copy link

dtrenz commented Nov 21, 2019

Anyone figure out a solution to this? I just encountered it today.

cocoapods-core (1.8.0)
cocoapods-keys (2.1.0)

@dtrenz
Copy link

dtrenz commented Nov 21, 2019

This appears to be a duplicate of #67. However, I'm still not clear on how to resolve this issue.

@dtrenz
Copy link

dtrenz commented Nov 21, 2019

Update: I figured out how to resolve this issue. :)

This error occurs when there are keys in the project that do not have values set for them (e.g. they were removed from the keychain directly, instead of via pod keys rm MyKey).

To fix this, run bundle exec pod keys to output a list of all keys in the project:

$ bundle exec pod keys
Keys for MyProject
 ├  DevelopmentAPIKey - my_development_api_key
 ├  StagingAPIKey - 
 └  ProductionAPIKey - my_production_api_key

Then, set (bundle exec pod set StagingAPIKey supersecretkeyvalue) or remove (bundle exec pod rm StagingAPIKey ) any keys in the list that do not have a value set.

Maybe it would be good to remove null keys from a project automatically during pod install? Or, maybe the error message could list out the orphaned/null keys?

@ashfurrow
Copy link
Collaborator

I'm a big +1 to the idea of listing orphaned keys during pod install. A nice little warning would be great!

@eliakorkmaz
Copy link

Hey, it's so strange (maybe I did not read all documentation) that when I use;

plugin 'cocoapods-keys', {
:keys => [
  "client-dev-key",
  "client-pilot-key",
  "client-prod-key",
]}

It throws same error so I delete all keys as @dtrenz said before in this thread then changed it to

plugin 'cocoapods-keys', {
:keys => [
  "ClientDevKey",
  "ClientPilotKey",
  "ClientProdKey",
]}

It worked for me and parsed well.
This is the first time that I got this error and it appears because of indentation I guess.

@ernichechelski
Copy link
Contributor

@dtrenz Your solution works great 😄 Thanks!

@SlaunchaMan
Copy link
Contributor

@eliakorkmaz These key names are used to generate Objective-C properties, and a dash is not a valid character for those. Definitely a good idea for a warning here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants