Closed dunghopper closed 9 years ago
Hey @dunghopper, would you mind sharing a complete stack trace with us?
Thanks for the quick response! Here you go:
*** First throw call stack:
(
0 CoreFoundation 0x024c61e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x0084f8e5 objc_exception_throw + 44
2 MyApp 0x0059b3b8 _ZL10__vm_raisev + 344
3 MyApp 0x0059b498 rb_vm_raise + 216
4 MyApp 0x00499451 rb_exc_raise + 17
5 MyApp 0x00492c37 rb_name_error + 135
6 MyApp 0x005519d5 rb_mod_const_missing + 165
7 MyApp 0x0058f1b4 _ZL20dispatch_rimp_callerPFP11objc_objectS0_P13objc_selectorzEmS1_iPKm + 46452
8 MyApp 0x00575a6c rb_vm_dispatch + 7164
9 MyApp 0x00552905 rb_const_get_0 + 1253
10 MyApp 0x00552950 rb_const_get + 32
11 MyApp 0x005924b1 rb_vm_const_lookup_level + 321
12 MyApp 0x0043e843 vm_get_const + 227
13 MyApp 0x0044657b rb_scope3 + 59
14 MyApp 0x004464be rb_scope2 + 126
15 MyApp 0x004463bb rb_scope1 + 123
16 MyApp 0x00449450 MREP_212DF469D2274B6CAD5761CFB0AD300B + 2432
17 MyApp 0x00003281 RubyMotionInit + 2465
18 MyApp 0x0000339d main + 109
19 libdyld.dylib 0x03738725 start + 0
20 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NameError
Also, I'm using ruby 1.9.3-p392
Could be related to https://github.com/HipByte/motion-cocoapods/issues/101. Try gem locking cocoapods
to 0.33.1 and see if it fixes the problem.
gem "cocoapods", "0.33.1"
That worked, kind of. It took me a minute to realize I had to re-install my pods after locking the cocoapods version... but after doing so, the app builds and runs without a name error.
BUT, after adding a class inheriting from PM::Menu::Drawer (based on the Readme example code) NameError is back! But a different one this time: uninitialized constant ProMotion::Menu::Drawer (NameError)
Here is app/menu_drawer.rb
class MenuDrawer < PM::Menu::Drawer
def setup
self.center = HomeScreen.new(nav_bar: true)
self.right = NavigationScreen
self.to_show = [:tap_nav_bar, :pan_nav_bar]
self.max_right_width = 250
end
end
Aha, like I said I'm new to RubyMotion. I didn't realize it was so prone to load-order problems. Rearranging app.files in my Rakefile to ensure gems get loaded before my app code fixed the new problem.
I don't actually set app.files
in my Rakefile for apps. I set app.detect_dependencies = true
which usually works. Can you post the relevant part(s) of your Rakefile? You might be doing stuff you don't need to.
You can also set dependencies for specific files... "foo depends on bar". http://www.rubymotion.com/developer-center/guides/project-management/#_files_dependencies
app.files_dependencies 'app/bar.rb' => 'app/foo.rb'
Here is my Rakefile:
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios'
begin
require 'bundler'
Bundler.require
rescue LoadError
end
Motion::Project::App.setup do |app|
app.name = 'MyApp'
app.version = "0.1"
app.short_version = "0.1"
app.detect_dependencies = true # This still gets the load order wrong, leading to NameErrors
# app.files = (app.files.select { |f| f =~ /\/lib\// } + app.files).uniq # << This works
end
(The app.detect_dependencies
option didn't work.)
I think this is a bug. Can you open a new issue?
@jamonholmgren : Do you want me to open a new issue here? Or are you saying it looks like the detect_dependencies
misbehavior is a bug in RubyMotion?
New issue here...which you did with #38 . Thanks!
I'm new to RubyMotion (and of course to ProMotion).
I am using ProMotion 2.0.1, Promotion-menu 1.0.0.beta1, motion-cocoapods 1.4.2, and MMDrawerController 0.5.7. All gems (via bundler) and pods appear to be installed correctly.
But, after installing the above gems and pods and running
rake
, compilation works, but crashes immediately when running on the simulator, with aNameError
somewhere in RubyMotionInit:I haven't yet added any ProMotion-menu code to my project. If I remove ProMotion-menu from my Gemfile, run
bundle install
again, and rebuild, the app works as before. The mere presence of the gem triggers the error.Any ideas? Thanks.