Skip to content

Latest commit

 

History

History
414 lines (295 loc) · 10.1 KB

README.md

File metadata and controls

414 lines (295 loc) · 10.1 KB

motion-fabric

Easily integrate Fabric in your RubyMotion application.

Supported Fabric kits:

Kit Name Description Supported?
Amazon Cognito Sync Develop apps quickly. Scale and run reliably.
Answers Finally, mobile app analytics you don't need to analyze.
Appsee Analyze user behavior with videos of sessions, heatmaps & analytics.
Crashlytics The most powerful, yet lightest weight crash reporting solution.
Digits No more passwords. Powerful login that grows your mobile graph.
GameAnalytics To build great games, you need to understand player behavior.
Mapbox Build the map your application deserves.
MoPub Drive More Mobile Ad Revenue.
Nuance Develop natural, engaging experiences with speech
Optimizely Fast, powerful A/B testing for mobile apps.
PubNub Realtime apps made simple.
Stripe Seamlessly integrated mobile payments.
Twitter The easiest way to bring Twitter content into your app.

Installation

Add this line to your application's Gemfile:

gem 'motion-fabric'

And then execute:

$ bundle

To install the required Pods execute:

$ rake pod:install

Configuration

NOTE: If you already have a Fabric team with an API KEY and BUILD SECRET, skip to step 5.

  1. Sign up for a Fabric account here

  2. You will receive a confirmation email. Enter your team's name and download the Xcode plugin (Dont worry, this is a separate app called Fabric.app. You wont need to open Xcode).

  3. Open Fabric.app and log in with your account (Important! You must keep Fabric.app open and logged in throughout the configuration process).

  4. Go to this page and retrieve your API KEY and BUILD SECRET for your organization in the step two. They will appear in a box in this form:

    "${PODS_ROOT}/Fabric/run" {api_key} {build_secret}
  5. Configure your Rakefile with the API KEY and BUILD SECRET:

    app.fabric do |config|
      config.api_key = "api_key"
      config.build_secret = "build_secret"
      config.kit 'Crashlytics'
    end
  6. Add the following line in your AppDelegate:

    Fabric.with([Crashlytics])
  7. Register your app with Fabric (this will run your app in the simulator):

    $ rake fabric:setup
    
  8. Go to fabric.io and verify that your app has been created

Crash reporting

To process your crash reports, Crashlytics needs a special file that contains the debug information of your app. This is needed to add method name, file name and line number annotations to the crash reports.

This file is called the dSYM file and is generated every time you build the application.

By default motion-fabric does NOT upload any dSYM file.

Usually, you only want crash reporting for your distribution and Crashlytics Beta builds:

if RUBYMOTION_ENV == 'release' || CRASHLYTICS_BETA == true
  Fabric.with([Crashlytics]) 
end

You can automate the upload of the dSYM file after you run certain rake commands:

# Upload the dSYM after creating a release build
Rake::Task["archive:distribution"].enhance do
  Rake::Task["fabric:dsym:device"].invoke
end

# Upload the dSYM after every simulator build
Rake::Task["build:simulator"].enhance do
  Rake::Task["fabric:dsym:simulator"].invoke
end

# Upload the dSYM after every device build
Rake::Task["build:device"].enhance do
  Rake::Task["fabric:dsym:device"].invoke
end

# Upload the dSYM after uploading a beta build to Crashlytics
Rake::Task["fabric:upload"].enhance do
  Rake::Task["fabric:dsym:device"].invoke
end

Beta distribution

Fabric offers another service under the name Crashlytics Beta which helps you distribute beta builds of your app to your testers.

You can customize the configuration for your beta distribution. You should use this to configure your AdHoc provisioninig profile.

app.fabric do |config|
  config.beta do
    app.identifier = "my_identifier"
    app.codesign_certificate = "my_certificate"
    app.provisioning_profile = "my_ad_hoc_provisioning_file"
  end
end

NOTE: Make sure to use an Ad-Hoc provisioning profile and not a developent one. You can create an Ad-Hoc provisioning profile in the provisioning portal

The only difference between your development builds and your Crashlytics Beta builds is the presence of the CRASHLYTICS_BETA constant which is only present for beta builds:

if Module.const_defined?(:CRASHLYTICS_BETA)
  puts 'This code will only run in builds distributed via Crashlytics Beta'
end

To create a beta build and upload it to Crashlytics Beta:

$ rake fabric:upload notes="my release notes" emails="[email protected],[email protected]" groups="group1,group2" notifications=YES

The notes, emails, groups and notifications options are optional.

NOTE: Be careful to include the group alias and not the group name in the groups option. You can find the group alias in the Fabric dashboard.

Go to the Crashlytics Beta section of your Fabric dashboard and check that your build was successfully uploaded.

Other Kits

Amazon Cognito Sync

Click here to learn how to get your API keys.

Add the following to your Rakefile:

config.kit 'AWSCognitoIdentity' do |info|
  info[:AWSCognitoIdentityPoolId] = 'MyPoolId'
  info[:AWSCognitoIdentityRegionType] = 'MyRegionType'
end

app.pods do 
  pod 'AWSCognito'
end

And the following to your application code:

Fabric.with([AWSCognito])

Answers

The answers SDK is already included in the Crashlytics SDK, so you simply have to initialize it by adding the following to your application code:

Fabric.with([Answers])

Appsee

Click here to learn how to get your API keys.

Add the following to your Rakefile:

config.kit 'Appsee' do |info|
  info[:apikey] = 'MyApiKey'
end

app.pods do 
  pod 'Appsee'
end

And the following to your application code:

Fabric.with([Appsee])

Crashlytics

See the Configuration section above.

Digits

Click here to learn how to get your API keys.

Add the following to your Rakefile:

config.kit 'Digits' do |info|
  info[:consumerKey] = 'MyKey'
  info[:consumerSecret] = 'MySecret'
end

app.pods do 
  pod 'Digits'
end

And the following to your application code:

Fabric.with([Digits])

GameAnalytics

Click here to learn how to get your API keys.

Add the following to your Rakefile:

config.kit 'GameAnalytics' do |info|
  info['api-key'] = 'MyKey'
  info['api-secret'] = 'MySecret'
end

app.pods do 
  pod 'GA-SDK-IOS'
end

And the following to your application code:

Fabric.with([GameAnalytics])

Mapbox

NOTE: The MapBox SDK is not currently supported

Click here to learn how to get your API keys.

Add the following to your Rakefile:

config.kit 'MGLAccountManager' do |info|
  info[:accessToken] = 'MyToken'
end

app.pods do 
  pod 'Mapbox-iOS-SDK'
end

And the following to your application code:

Fabric.with([MGLAccountManager])

MoPub

Add the following to your Rakefile:

app.pods do 
  pod 'mopub-ios-sdk'
end

And the following to your application code:

Fabric.with([MoPub])

Nuance

NOTE: The Nuance SDK is not currently supported

Click here to learn how to get your API keys.

Add the following to your Rakefile:

config.kit 'SKSession' do |info|
  info[:appKey] = 'MyKey'
  info[:url] = 'MyURL'
end

app.pods do 
  pod 'SpeechKit'
end

And the following to your application code:

Fabric.with([SKSession])

Optimizely

Click here to learn how to get your API keys.

Add the following to your Rakefile:

config.kit 'Optimizely' do |info|
  info[:socket_token] = 'MyToken'
end

app.pods do 
  pod 'Optimizely-iOS-SDK'
end

And the following to your application code:

Fabric.with([Optimizely])
Optimizely.startOptimizelyWithAPIToken("{api-key}", launchOptions:launchOptions)

PubNub

Click here to learn how to get your API keys.

Add the following to your Rakefile:

config.kit 'PubNub' do |info|
  info['publish-key'] = 'MyPublishKey'
  info['subscribe-key'] = 'MySubscribeKey'
  info['secret-key'] = 'MySecretKey'
end

app.pods do 
  pod 'PubNub/Fabric'
end

And the following to your application code:

Fabric.with([PubNub])

Stripe

Click here to learn how to get your API keys.

Add the following to your Rakefile:

config.kit 'STPAPIClient' do |info|
  info[:publishable] = 'MyPublishableAPIKey'
end

app.pods do 
  pod 'Stripe'
end

And the following to your application code:

Fabric.with([STPAPIClient])

Twitter

Click here to learn how to get your API keys.

Add the following to your Rakefile:

app.fabric do |config|
  config.kit 'Twitter' do |info|
    info[:consumerKey] = 'MyKey'
    info[:consumerSecret] = 'MySecret'
  end
end

app.pods do 
  pod 'TwitterKit'
end

And the following to your application code:

Fabric.with([Twitter])