【问题标题】:Ruby problems with formotion moduleformotion 模块的 Ruby 问题
【发布时间】:2017-11-28 17:18:57
【问题描述】:

我需要运行一个用 ruby​​ 编写的应用程序。它在 IOS11 之前工作,但现在抛出错误。我已经安装了 formotion 以及所有适当的 gem 和 SDK。我无法让编译器识别出里面有一个 formotion gem。

我收到一个未捕获的异常“名称错误”,它表示我试图在 formotion 类中实例化的变量是一个未初始化的常量。

任何有关此错误的帮助将不胜感激。

这里有一些代码,错误指向row.text_field.resignFirstResponder

module RowType
class PickerWithDoneRow < PickerRow
  include RowType::ItemsMapper

  def after_build(cell)
    super
    keyboardDoneButtonView              = UIToolbar.new
    keyboardDoneButtonView.barStyle     = UIBarStyleBlack
    keyboardDoneButtonView.tintColor    = "#000".uicolor
    keyboardDoneButtonView.translucent  = false
    keyboardDoneButtonView.sizeToFit

    # keyboardDoneButtonView.barTintColor = "#BFC3C8".uicolor
    keyboardDoneButtonView.barTintColor = "#EFEFF4".uicolor

    doneButton = UIBarButtonItem.alloc.initWithTitle("Done", style:UIBarButtonItemStylePlain,  target:self, action: 'picker_done_clicked')
    spacer1    = UIBarButtonItem.alloc.initWithBarButtonSystemItem(UIBarButtonSystemItemFlexibleSpace, target:self, action: nil)
    spacer     = UIBarButtonItem.alloc.initWithBarButtonSystemItem(UIBarButtonSystemItemFlexibleSpace, target:self, action: nil)
    keyboardDoneButtonView.setItems([spacer, spacer1, doneButton])

    row.text_field.inputAccessoryView = keyboardDoneButtonView
  end

  def picker_done_clicked

    row.text_field.resignFirstResponder
  end
end
end

【问题讨论】:

  • 不要使用预装的 ruby​​,安装任何 ruby​​ 版本管理器(例如rvm.io)并安装您在操作系统更新之前使用的确切版本的 ruby​​在这个包管理器中 i>.
  • 我已经做到了。我正在使用带有 2.0.0-247 的 RVM。此外,所有的宝石似乎都已到位

标签: iphone ruby xcode rubymotion formotion


【解决方案1】:

程序所需的一些 gem 没有包含在代码中作为需要安装的 gem。所需的宝石是:

    bigdecimal (1.2.0)
  bubble-wrap (1.3.0)
  bundler (1.16.0)
  formotion (1.5.1)
  io-console (0.4.2)
  json (1.7.7)
  minitest (4.3.2)
  motion-csv (0.0.2)
  motion-require (0.0.7)
  motion-testflight (1.5)
  psych (2.0.0)
  rake (10.1.0, 0.9.6)
  rdoc (4.0.0)
  sugarcube (1.1.0)
  test-unit (2.0.0.0)

【讨论】:

    猜你喜欢
    • 2011-05-14
    • 1970-01-01
    • 2011-06-14
    • 2017-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多