UPDATE 17-08-2016: HypBite have just released a very helpful gem motion-provisioning. Its job is to simplify provisioning for iOs, tvOS and macOS (previously OS X)

It takes a long time to develop an app. In RubyMotion, that time is kinda reduced in many ways.

There are many things that Xcode does behind the scenes that RubyMotion doesn’t. I guess all those who use RM tend to have a fetish for control and writing everything in plain text. I share in that kink too.

One of the things you must do is configure your app manually with the right configs for the AppStore. So lets get down on it:

This setup is ideal for an indie developer distributing their own apps. Follow this steps in the order from 1 going down.

  1. Create an App ID (Avoid using the WildCard*), this can be the greatest source of headaches. It looks like com.paxilabs.spota
  2. Create a Development & Distribution Certificate. Ideally you only need 1 of each of these certificates for ALL your apps, keep this files safe from wicked eyes.
  3. Create 2 Provisioning Profiles. 1 Development and 1 Distribution profile for each individual app. Every app must have 2 of these profiles.
  4. Register your devices for testing your apps. Just makes life easy.

So thats the first side done. We now need to do some iTunes Connect configurations. After loging into iTunes Connect:

  1. Create a new app record. In the Bundle ID select your ID from the list.
  2. Follow the rest of the requirements there. Its very straight forward and it wont submit until its all done properly.

Download Code-signing Dev & Dist Certificates and Provisioning Profiles. This is how you could setup your env.

Developer/Apple/ios/CertificateSigningRequest.certSigningRequest
Developer/Apple/ios/ios_development.cer
Developer/Apple/ios/ios_distribution.cer

I use Xcode to download the Provisioning Profiles. But I recommend you download yours directly and place them in an appropriate location away from your RubyMotion app directory, please.

RubyMotion Rakefile

Here is a sample of what your file would resemble.

# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios'
require "rubygems"
require 'bundler'
Bundler.require

Dotenv.load

Motion::Project::App.setup do |app|
  app.name          = "Spõta"
  app.frameworks   += %w(CoreLocation CoreMotion)
  app.short_version = ENV["SHORT_VERSION"]
  app.identifier    = ENV["APP_IDENTIFIER"]

  # app.pods do
    # pod "Firebase"
    # pod "Raven"
  # end

  app.info_plist["NSLocationAlwaysUsageDescription"]    = "We utilize location data to enhance your app experience."
  app.info_plist["NSLocationWhenInUseUsageDescription"] = "We utilize location data to enhance your app experience."
  app.info_plist["NSMotionUsageDescription"]            = "We would like to use your motion data."
  app.info_plist["UIBackgroundModes"]                   = ["location"]

  app.development do
    app.codesign_certificate = ENV["DEV_CODESIGN_CERTIFICATE"]
    app.provisioning_profile = ENV["DEV_PROVISIONING_PROFILE"]
  end

  app.release do
    app.codesign_certificate = ENV["CODESIGN_CERTIFICATE"]
    app.provisioning_profile = ENV["PROVISIONING_PROFILE"]
  end
end

Now you can rake device. Make sure your connected device is one of the ones added earlier in step 4 above. If the app launches on the device successfully, then you are ready to distribute.

Finally!

I recommend you use motion-appstore from here on. Follow their instructions.