A game-changer! Automatic code reloading in RMQ and RedPotion stylesheets

Jamon Holmgren came up with a very clever way to auto reload stylesheets in the dev environment. He wrote a blog post about it here. He and I then developed it in both RMQ and RedPotion.

Here is a gif of it in action.


To try this, updated your RedPotion:

gem update ruby_motion_query redpotion

Then launch your app in the simulator and enter this in the REPL:


Or in RedPotion:


There still are some rough edges, but I do NOT want to go back to the way we use to do it. Check it out, it’s really awesome.

New column

We have a new column (see below) in the Dispatch written by Derek Greenberg, “Derek’s Apothecary. Learning to cook with RedPotion”.

In every issue Derek is going to teach you something about RubyMotion and/or RedPotion.

If you missed the last issue, you can find it here: issue #54.

Happy coding, Todd Werth (@twerth)

RubyMotion community

Articles, news, new Gems, and blog posts from the RubyMotion community.

April 6th, 2015 | new gem | by RubyMotion
motion-gradle – Integrate 3rd-party Java dependencies in RubyMotion for Android projects using Gradle

April 3th, 2015 | blog post | by Jamon Holmgren
ProMotion 2.3 – Notable Changes

April 22th, 2015 | blog post | by RubyMotion
Announcing new speakers for RubyMotion #inspect 2015

April 18th, 2015 | new gem | by Thomas Broomfield
motion_panel – A native Rubymotion wrapper around the Mixpanel API

April 18th, 2015 | new gem | by Jamon Holmgren
compressor – Concatenates your RubyMotion source files for faster compile times.

April 17th, 2015 | blog post | by Jamon Holmgren
Speeding up RubyMotion compile times by 95%

April 16th, 2015 | new gem | by Darin Wilson
moran – Simple JSON parsing and generation for RubyMotion Android

April 16th, 2015 | blog post | by Gant Laborde
RubyMotion Android in the Emulator with Genymotion

April 15th, 2015 | blog post | by Jamon Holmgren
Live Code Reloading in RedPotion

April 15th, 2015 | blog post | by RubyMotion
New in RubyMotion for Android: Automatic Setup, RubyMine, Intel Architecture, Gradle, Improvements

April 11th, 2015 | new gem | by Gant Laborde
PackingPeanut – App persistent data for RubyMotion Android

April 1th, 2015 | gem. It now works in RubyMotion | by Felix Krause
snapshot – Automate taking localized screenshots of your iOS app on every device

Derek’s Apothecary. Learning to cook with RedPotion


New RedPotion documentation

We’ve started to assemble the documentation for RedPotion. You can read it at docs.redpotion.org

In RedPotion, you can use find instead of rmq

You can still use rmq, find is just an alias, but find often describes better what you’re doing:



Corrupt/missing Cocoapods Specs repository?

You run rake pod:install on a freshly createdRedPotion app and it hangs on Updating spec repo master. Presumably, you’ve already run pod setup one time on your machine, so what gives?

If you see an error message about pod not being able to find the master spec repo when you run rake pod:install --verbose, you can perform a clean pod setup:

> pod repo remove master
> pod setup

Now you should be able to run rake pod:install.

Mysterious errors when running rake?

Running rake was working perfectly last night, but this morning, you are getting mysterious errors, such as

Simulator session started with error: Error Domain=NSPOSIXErrorDomain Code=3 "Failed to lookup the process ID of com.your_domain_here.my_awesome_app after successful launch.  Perhaps it crashed after launch."

Your environment might be borked. Try this:

rake newclear

The nuke task performs the following operations:

Cleaning Project...
    Delete ./build
    Delete ./resources/my_awesome_app.momd
    Delete /Users/<your user>/.rvm/gems/ruby-2.1.1/gems/cdq-1.0.2/lib/../vendor/cdq/ext/build-iPhoneSimulator
     Clean ./Pods.xcodeproj for platform `iPhoneSimulator'
     Clean ./Pods.xcodeproj for platform `iPhoneOS'
    Delete vendor/Pods/build-iPhoneSimulator
    Delete /Users/<your user>/Library/RubyMotion/build
    Delete vendor/Pods

Resetting simulator...


Setting up cocoapods...

Installing cocoapod dependencies...


Most of the items (other than rvm gems and /Users/<your user>/Library/RubyMotion/build) that are deleted and cleaned exist within your current project directory. Nuking your project is a benign operation. since running rake rebuilds everything that was nuked, so give it a try.

Android tip of the week by Darin Wilson


If you’ve been using motion-maven to manage your 3rd party Java dependencies, you should consider switching to motion-gradle.

Based on the deep integration of Gradle into Android Studio, it appears that Google is throwing all of its mighty weight behind Gradle, so that appears to be where the future lies. Plus, the motion-maven project page now directs you to motion-gradle, so HipByte is apparently throwing its not-quite-as-mighty-as-Google’s weight behind it as well.

Switching to motion-gradle is very straight-forward. The syntax is almost identical, and the package names will be identical in most cases as well.

Another incentive to switch is that motion-gradle can do something that motion-maven can’t: manage Android support libraries:

app.gradle do
 # add the v4 support library
  dependency "com.android.support", artifact: "support-v4", version: "18.0.+"

This allow you to put all of your external dependencies into one place, and not have them scattered between app.gradle and app.vendor_project. This should make for a much more readable Rakefile.



My company InfiniteRed sponsors this newsletter, and does a lot of work on various gems for RubyMotion.

We exclusively work in RubyMotion on both iOS and Android for clients all over the world.

Contact us if you ever need help working on a project, mentoring, or other development services . We have an awesome team.


RubyMotion News


Rubymotion 3.10 Released

  • [Android] Fixed typo in android.rb template which breaks incremental builds. Thanks to Darin Wilson for the patch (pull request #210).
  • [Android] Fixed rake {emulator,device} debug=1 for multi-arch projects.
  • [Android] Added Module#const_get.
  • [Android] Fixed a bug where calling a Java method that returned a large non-Object Java array would crash the runtime by creating a JVM stack overflow.
  • [Android] Fixed a bug when calling the super version of a Java method, where it would fail if the current stack trace included a super Java call of the same method name but of a different class.
  • [Android] Fixed a bug where #initialize methods would not be honored when defined in superclasses.
  • [Android] Fixed a bug where an assertion would happen when trying to resolve a Java class at runtime.
  • [Android] Fixed a bug where a crash would happen when changing the value of a local variable that previously contained a reference to a constant literal (ex. symbol).
  • [iOS] Added support for iOS 8.4 (beta).
  • [iOS] Fixed a wrong in Watch app templete which notification handler should invoke call method for Proc handler object. Thanks to Dave Shapiro for the patch (pull request #207).
  • [iOS] Fixed a bug which it would be trigger a crash when large structures (like CMTime) will be passed into Objective-C methods/funtions on ARM64.
  • [iOS] Fixed a bug which it would be trigger a crash when it will call NSDecimalNumber#decimalValue method on ARM64.
  • [iOS] Fixed a bug which UIInterfaceOrientation would cause link error when specify iOS 8.2 or below as deployment target.
  • [iOS, OSX] Fixed a bug where small structures with only float members could not be passed/returned in a 64-bit environment.

Rubymotion 3.9 Released

  • [Android] Projects now support multiple architectures. The app.arch variable is replaced by app.archs which takes an array of architectures. By default, we still build for arm 32-bit only.
  • [Android] Added x86 (Intel 32-bit) support. This is mainly used to run apps in faster emulators (such as Genymotion). To build for x86, simply edit your project’s Rakefile to add the architecture (app.archs << ‘x86’).
  • [Android] Added the app.optional_features to let users specify optional features in the manifest file.
  • [Android] Make sure all Ruby file paths are flattened into single Array. Thanks to Darin Wilson for the patch (pull request #189).
  • [iOS, OSX] The Ruby runtimes have been rebuilt with Xcode 6.3 final.
  • [iOS] Fixed ARM64 issues introduced since Xcode 6.3 final.
  • [iOS] Fixed a bug where the REPL would crash when using an old simulator.
  • [iOS] Fixed a bug where the value of app.version and app.short_version between the container and watch apps were not synchronized when submitting to iTunes Connect. Thanks to digitalfx for the patch (pull request #205).
  • [iOS] Fixed a bug where watch apps could not be submitted to iTunes Connect.
  • [iOS] Fixed a bug where satch apps would not follow the deployment target of the host app.
  • [iOS] Fixed a bug where rake watch would not launch the watch app when using Xcode 6.3 stable.
  • [iOS] Fixed a bug where dSYM files were embeded even if the app was built with release mode if app has extensions.
  • [OSX] Fixed a bug where app would crash when running tests if the UIDevice class is defined.
  • [iOS, OSX] Fixed a bug where small structures with only float members could not be passed/returned in a 64-bit environment.

Rubymotion 3.8 Released

  • The toolchain has been upgrated to LLVM 3.5.
  • [Android] Added the motion android-setup command which downloads and installs the Android SDK and NDK automatically. Run the `motion android-setup –help’ command for more information.
  • [Android] Added app.support_libraries option in the Rakefile, which is an array containing the names of Android support libraries to be included in your app E.g.:
  app.support_libraries << 'google-play-services'
  app.support_libraries << 'android-support-v4'
  • [Android] Added support for API level 22. Removed support for very old versions of Android that are no longer supported in the SDK.
  • [Android] Added support to generate Ctags file via the rake ctags task.
  • [Android] Fixed a bug where classes.dex would not be re-generated when a resource file was changed. Thanks Eito Katagiri for the patch.
  • [Android] Fixed a bug where running specs would crash.
  • [iOS] Fix a bug where a build error would happen when building a project for ARM 64-bit using Xcode 6.3 Beta.
  • [iOS, OSX] Fixed the build system to not recompile .strings files on every build.
  • [iOS, OSX] Fixed a bug where rake profile could not launch Instruments.app when it will specify Instruments template with Xcode 6.2.
  • [iOS] Fixed a bug where rake background_fetch=true would not work with with Xcode 6.2.
  • [iOS, OSX] Fixed the build system to print a warning if a framework included in the Rakefile does not have a corresponding .bridgesupport file (e.g. it has been mispelled).
  • [iOS, OSX] Fixed the build system to not delete .storyboardc files if the corresponding .storyboard file does not exist.
  • [iOS, OSX] Fixed a rare case where gdb would be used instead of LLDB when running in debug mode.
sudo motion update


Testing on Android devices is fun:


One more thing


The Apple Watch is being shipped today to those lucky enough to be in the first shipment. I’ve created a very simple RubyMotion watch app. You have to use IB for your view, but the rest of your code goes into the app running on the phone. It wasn’t terrible difficult.

If you create something for the Apple Watch, no matter how small, let me know and I may put it in the next Dispatch.

If you have any tips, blog posts, or comments, please send emails to todd@infinitered.com