【问题标题】:`initialize': no implicit conversion of String into Integer (TypeError)`initialize':没有将 String 隐式转换为 Integer (TypeError)
【发布时间】:2019-01-19 21:01:12
【问题描述】:

错误是:

./batch_build.rb:83:in `initialize': no implicit conversion of String into Integer (TypeError)  
  from ./batch_build.rb:83:in `open'
  from ./batch_build.rb:83:in `<main>'

第 83 行指的是哪一行:

IO.open("xcodebuild -scheme Runner archive -archivePath '/tmp/#{BUILD_DIR}' -UseNewBuildSystem=NO -allowProvisioningUpdates") do |line|

    hasError = true if line.downcase.include? 'error' # line 85

    `xcode /tmp/#{BUILD_DIR}/Runner.xarchive` # line 87

end # line 89

相关的行是:

KEY_FILE = 'android/key.properties'
verCode = `cat #{KEY_FILE} | grep versionCode | cut -d '=' -f 2`.to_i
verCode += 1
BUILD_DIR = "xyz_#{verCode}"

什么是错误?

【问题讨论】:

    标签: ruby


    【解决方案1】:

    该死,应该是popen 而不是open, 在第 83 行的 do 之前也缺少 .each

    嗯..我应该删除这个问题吗?

    【讨论】:

    • 在发布问题几分钟后,我发现我的问题的次数更多 :) 我认为详细了解细节会有所帮助。
    • 是的,我认为这个词是rubber duck programming 或什么的......'__')
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-19
    相关资源
    最近更新 更多