SiarheiFedartsou / fastlane-plugin-versioning

Extends fastlane versioning actions. Allows to set/get versions without using agvtool and do some other small tricks.
MIT License
504 stars 60 forks source link

undefined method '[]' for nil:NilClass #19

Closed LLLaiYoung closed 6 years ago

LLLaiYoung commented 6 years ago

sorry, I don't know that what happened。 I can some target, but some not.Are all calling the same method。

Here is an error。

20:41:43: --- Step: increment_build_number_in_plist ---

20:41:43: undefined method `[]' for nil:NilClass

20:41:43: Unable to find plist file at '/Users/laiyoung_/Documents/QT/QingTui_iPhone/${SRCROOT}/QingTui_iPhone/QingTui_Distribution/QingTui_Distribution.plist' +------------------+-------------+ | Lane Context | +------------------+-------------+ | DEFAULT_PLATFORM | ios | | PLATFORM_NAME | ios | | LANE_NAME | ios Archive | | BUILD_NUMBER | true | +------------------+-------------+ 20:41:43: undefined method `split' for true:TrueClass

my method

private_lane :UpdateBuild_number do |options|
  qt_target_name = options[:qt_target_name]
  increment_build_number_in_plist(target: "QingTui_#{qt_target_name}") 
  increment_build_number_in_plist(target: "Share_#{qt_target_name}") 
  build_number = get_info_plist_value(path: "./QingTui_iPhone/QingTui_#{qt_target_name}/QingTui_#{qt_target_name}.plist", key: "CFBundleVersion")

  # git_commit(path: "./QingTui_iPhone", message: "update build_number to #{build_number}") 
  # push_to_git_remote 

  puts build_number
  build_number
end

thank you!

SiarheiFedartsou commented 6 years ago

@CYBoys Hi, thanks for posting this. Do you have some relative paths in your Info.plist path setting?

LLLaiYoung commented 6 years ago

Thank you for answering! '/Users/laiyoung_/Documents/QT/QingTui_iPhone/${SRCROOT}/QingTui_iPhone/QingTui_Distribution/QingTuiDistribution.plist',This path is wrong。 The right should be like this '/Users/laiyoung/Documents/QT/QingTui_iPhone/QingTui_iPhone/QingTui_Distribution/QingTui_Distribution.plist'.

SiarheiFedartsou commented 6 years ago

@CYBoys Sorry, I think you misunderstood my question. Could you share this value from your build settings? Screenshot

LLLaiYoung commented 6 years ago

image this is target wrong

LLLaiYoung commented 6 years ago

@SiarheiFedartsou But my target is also like that, Such as this is no problem image

SiarheiFedartsou commented 6 years ago

@CYBoys It seems that you use @{SRCROOT}, but not @(SRCROOT)(difference in brackets types). This plugin currently substitutes only @(SRCROOT), I didn't know that Xcode supports curly braces for such kind of variables. So, as a workaround I can recommend you to use @(SRCROOT) until I fix it(I think I will in a couple of days).

SiarheiFedartsou commented 6 years ago

@CYBoys just make a double-click on this value and I believe you will see @{SRCROOT} there :)

LLLaiYoung commented 6 years ago

So, thank you!

SiarheiFedartsou commented 6 years ago

Keep it open until fix of ${SRCROOT} issue.

LLLaiYoung commented 6 years ago

ok

SiarheiFedartsou commented 6 years ago

@CYBoys Just fixed this issue and released version 0.3.4. Please check if it is working with curly brackets(with ${SRCROOT}) after update and feel free to re-open this issue in case of any problems.