Closed andrewhavens closed 9 years ago
I was on 0.0.7. Just upgraded to 0.0.9 and still seeing this issue.
Do you have an public example I could get my hands on ?
I don't understand why and how you get this error
Unfortunately, the repo is not public. But I have identified the code that is causing this error. In a PM::TableScreen (note that this is not a PM::XLFormScreen) This code is causing the error:
def table_data
[{
cells: users.map do |user|
{
title: user.name,
remote_image: {
url: user.avatar_url,
placeholder: 'avatar/default_avatar'
}
}
end
}]
end
It seems that PM-XLForm is overriding the PM::TableScreen behavior. Otherwise, the backtrace should be related to PM::TableScreen.
I found the issue. user.avatar_url
was returning nil
. I changed it to return an empty string and now it is correctly displaying the placeholder image. However, I'm still concerned that PM-XLForm is monkey-patching the PM::TableScreen behavior.
As I resolve the issue of #8 with the gems and apps.pods, could you paste them ?
My pods:
app.pods do
pod 'DateTools' # provides "time ago" date formatting
pod 'JMImageCache'
pod 'SDWebImage'
pod 'CrittercismSDK', '5.3.0' # Crash Reporting
pod 'Branch' # Deep Linking service
end
Gems:
source 'https://rubygems.org'
gem 'bundler', '>= 1.10.2'
gem 'rake'
gem 'motion-cocoapods'
gem 'redpotion', github: 'infinitered/redpotion'
gem 'cdq' # Core Data
gem 'afmotion' # Networking
gem 'RedAlert'
gem 'motion-mastr' # NSMutableAttributeString
gem 'moticons' # icons
gem 'motion-support', require: ['motion-support/inflector'] # adds singularize and pluralize methods to String
gem 'sugarcube', require: ['sugarcube-nsdate'] # adds date helpers to String
# Forms
gem 'ProMotion-form'
gem 'ProMotion-XLForm'
# Environment Variables
gem 'dotenv'
gem 'motion-env'
#
# Development / Testing Dependencies
#
gem 'motion-stump' # stubbing and mocking
gem 'multipart-post' # for uploading dSYM files to crash reporting services
# Debugging tools
gem 'newclear' # Completely wipe out the simulator and rebuild
gem 'mem-watcher'
# Testing
gem 'guard-motion', require: 'guard/motion', github: 'satoyos/guard-motion', branch: 'inherit_Plugin'
# For uploading builds to iTunes Connect
gem 'motion-appstore'
So here's something that I've been noticing...this is possibly a separate issue, but anytime I have an error in my app, the backtrace always the same file and line number (xl_sub_form_screen.rb:40
). I am not even creating any xl_sub_form_screen in this flow.
2015-09-24 22:41:25.621 MyApp[35249:7437980] xl_sub_form_screen.rb:40:in `table_data': undefined method `comments' for nil:NilClass (NoMethodError)
from xl_sub_form_screen.rb:40:in `promotion_table_data'
from xl_sub_form_screen.rb:40:in `numberOfSectionsInTableView:'
from xl_sub_form_screen.rb:40:in `block in set_up_header_footer_views'
from xl_sub_form_screen.rb:40:in `set_up_header_footer_views'
from xl_sub_form_screen.rb:40:in `screen_setup'
from xl_sub_form_screen.rb:40:in `try:'
from xl_sub_form_screen.rb:40:in `screen_init:'
from xl_sub_form_screen.rb:40:in `new:'
from xl_sub_form_screen.rb:40:in `block in view_post:'
from xl_sub_form_screen.rb:40:in `block in reload'
from xl_sub_form_screen.rb:40:in `block in find:'
from xl_sub_form_screen.rb:40:in `block in request:'
Ok, if I use your gems and pods and try this
class TestScreen < PM::TableScreen
def table_data
[{
cells: [
{
name: :the_future,
title: "The Future",
remote_image: {
url: nil
}
}
]
}]
end
end
The app crash with
2015-09-25 08:22:13.352 test[40956:1423598] xl_sub_form_screen.rb:40:in `set_remote_image': undefined method `to_url' for nil:NilClass (NoMethodError)
from xl_sub_form_screen.rb:40:in `setup:'
from xl_sub_form_screen.rb:40:in `create_table_cell:'
from xl_sub_form_screen.rb:40:in `tableView:cellForRowAtIndexPath:'
2015-09-25 08:22:13.373 test[40956:1423598] *** Terminating app due to uncaught exception 'NoMethodError', reason: 'xl_sub_form_screen.rb:40:in `set_remote_image': undefined method `to_url' for nil:NilClass (NoMethodError)
from xl_sub_form_screen.rb:40:in `setup:'
from xl_sub_form_screen.rb:40:in `create_table_cell:'
from xl_sub_form_screen.rb:40:in `tableView:cellForRowAtIndexPath:'
If I change the gem to use master, I got the following
2015-09-25 08:25:38.004 test[41869:1427790] form_screen.rb:30:in `set_remote_image': undefined method `to_url' for nil:NilClass (NoMethodError)
from form_screen.rb:30:in `setup:'
from form_screen.rb:30:in `create_table_cell:'
from form_screen.rb:30:in `tableView:cellForRowAtIndexPath:'
2015-09-25 08:25:38.025 test[41869:1427790] *** Terminating app due to uncaught exception 'NoMethodError', reason: 'form_screen.rb:30:in `set_remote_image': undefined method `to_url' for nil:NilClass (NoMethodError)
from form_screen.rb:30:in `setup:'
from form_screen.rb:30:in `create_table_cell:'
from form_screen.rb:30:in `tableView:cellForRowAtIndexPath:'
Which is a correct crash message. It looks like the correction in #8 also resolve this one... Time to bump version ;)
I started getting this error when I upgraded to iOS 9. It might not be related, but I will continue to look into it.