Rails Side
For an iOS game I’ll eventually release, I store images for each “story” on a Story model. image_file
is one of the attributes and it’s just a string of the image’s file name. There’s a before_save callback that stores a Base64 binary version of the image on that model’s instance.
RubyMotion Side
After receiving a “Story” object in RubyMotion through an API call, I initialize an NSData object with the Base64 encoded image. These are stored with NSDefaults. I’m using a globally variable here. Usually recommended blah blah blah.
This app uses RubyMotion Query (RMQ). This is an awesome library. Recently, RMQ and ProMotion(and more) combined as RedPotion. Haven’t tried that yet, but I’m excited to. Anyway, later when showing Story views, I set the image in RMQ. It shouldn’t be too hard to adapt the code below if you aren’t using RMQ. The part that matters is UIImage.imageWithData
.