PhraseApp OTA is currently in beta.

Introduction

PhraseApp Over the Air for iOS lets you update translations in your iOS app without having to release it every single time.

By including our SDK, your app will check for updated translations in PhraseApp regularly and download them in the background.

Install the SDK

You can install the SDK manually, via Carthage or Cocoa Pods:

Carthage

Add the following line into your Cartfile:

binary "https://raw.githubusercontent.com/phrase/ios-sdk/master/PhraseApp.json" ~> 1.0.0

Run carthage update  and add the PhraseApp.framework  to your project by following the steps mentioned in the Carthage documentation.

Cocoa Pods

Add the following line into your Podfile:

pod 'PhraseApp'

Run pod install  for installing PhraseApp. If you are new to CocoaPods read the Getting Started guide for further instructions.  

Manual Download

  1. Download the latest release from https://github.com/phrase/ios-sdk/releases 
  2. Add PhraseApp.framework in Xcode as linked binary to your target.

Configuration

Initialize the SDK by calling the following code:

PhraseApp.shared.setup(
  distributionID: <Distribution ID>,
  environmentToken: <Environment Secret>
)

To update your localization files simply call PhraseApp.shared.updateTranslations() 

Note: This method will raise an exception if you did not set up the SDK properly

We recommend to simply call both function within your AppDelegate in the applicationDidFinishLaunchingWithOptions  method.

Disable Swizzling

  • In case you want to disable swizzling you can set PhraseAppMainBundleProxyEnabled  to NO  in Info.plist 

Callbacks

In case you want to handle successful translation updates you can attach a callback handler:

PhraseApp.shared.updateTranslations { result in
            switch result {
            case .success(let updated):
            case .failure:
            }
        }

Making updates visible

Usually, the updated translations will be automatically visible to the user the next time app launches. If you want to enforce the new translations to be visible immediately, you need to handle this yourself, e.g. by reloading the ViewController on a successful callback:

func reloadRootViewController() {
  DispatchQueue.main.async {
    let storyboard = UIStoryboard.init(name: "Main", bundle: nil)
    let appDelegate = UIApplication.shared.delegate as! AppDelegate
    appDelegate.window?.rootViewController = storyboard.instantiateInitialViewController()
  }
}

Note: This does not work for Storyboards

Debug Mode

If you need further information you can enable the debug mode to get additional logging of the PhraseApp.framework into the console:
PhraseApp.shared.debugMode = true 

Set timeout for requests

You can set a timeout for the requests against PhraseApp by calling:

PhraseApp.shared.setup(
  distributionID: <Distribution ID>,
  environmentToken: <Environment Secret>,
  timeout: <Double>
)

The default timeout is 10 seconds.

Note: Connection that are taking longer than 10 seconds will be closed by our servers.

Fallback

In case new translations cannot be fetched from PhraseApp via the SDK we will always use the latest translation files that the installation received. If the App never received new files from PhraseApp it will use the compiled translation files of your app. This prevents errors in case of any technical difficulties or networking errors. Therefore we recommend to keep your translation files that are compiled into the app up to date with every release.

Data

The SDK will communicate with the PhraseApp Over the Air service in order to check for updates and includes the following details with each request:

  • Device identifier (e.g. "F3AFCB10-80A2-84CB-94C0-27F5EF58876D". Unique for this app and therefore does not allow tracking a specific device.)
  • App version (e.g. "1.2.0")
  • Last update of the translation file (e.g. "1542187679")
  • SDK version (e.g. "1.0.0")
  • Locale (e.g. "de-DE")
  • File format (e.g. "strings")
  • Client (e.g. "ios")
  • Distribution ID (ID of your distribution in PhraseApp)
  • Environment secret (to distinguish between development from production)

Auditing

The SDK is closed source and can thus not be viewed or modified. We do provide the possibility for audits in case this is a requirements of your organization. Please contact us for more details on code audits.

Troubleshooting

Translations are not updated

  • Confirm that the distribution id and environment secret are correct.
  • Check whether you created a release on PhraseApp for your current app version
  • Updated translations are visible automatically after the next app launch. Try reloading the ViewController to make changes appear immediately.

The wrong version of translations are used

  • Please make sure that you have the CFBundleShortVersionString  for the app set and are using semantic versioning (e.g. <major>.<minor>.<point>).
  • Check on PhraseApp whether you do have a release with the latest translations and the current app version.
Did this answer your question?