When using ProMotion and motion-kit I get this error:
2014-10-27 20:57:15.880 revisit_motion[40985:1651453] comment_cell.rb:25:in `setup:': Invalid Reference - probably recycled (WeakRef::RefError)
from table.rb:121:in `create_table_cell:'
from table.rb:110:in `table_view_cell:'
from table.rb:153:in `tableView:cellForRowAtIndexPath:'
2014-10-27 20:57:15.894 revisit_motion[40985:1651453] *** Terminating app due to uncaught exception 'WeakRef::RefError', reason: 'comment_cell.rb:25:in `setup:': Invalid Reference - probably recycled (WeakRef::RefError)
from table.rb:121:in `create_table_cell:'
from table.rb:110:in `table_view_cell:'
from table.rb:153:in `tableView:cellForRowAtIndexPath:'
comment_cell.rb
looks like this:
class CommentCell < PM::TableViewCell
include PM::TableViewCellModule
def initWithStyle(data_cell, reuseIdentifier: identifier)
super
self
end
def setup(data_cell, table_screen)
super
@table_screen = table_screen
@attrs = data_cell[:style]
self.selectionStyle = UITableViewCellSelectionStyleNone
@layout ||= begin
layout = CommentCellLayout.new(root: self)
layout.build
layout.avatar.sizeToFit
layout.body.sizeToFit
layout.on :comments do
perform_comments
end
layout
end
@layout.username.text = @attrs[:username]
self
end
...
end
And comment_cell_layout.rb
is:
class CommentCellLayout < MotionKit::Layout
view :username
view :avatar
view :body
end
Changing comment_cell_layout.rb
to:
class CommentCellLayout < MotionKit::Layout
view :username
view :avatar
view :body
def initialize(args={})
super
@preset_root = WeakRef.new args[:root]
end
end