Skip to content

Latest commit

 

History

History
59 lines (40 loc) · 2.2 KB

README.md

File metadata and controls

59 lines (40 loc) · 2.2 KB

Cordova Xcode Detector Plugin

Plugin's Purpose

The purpose of the plugin is to create a method for Cordova based iOS applications to determine at runtime whether an application was installed via installed from XCode to an attached USB device or iOS Simulator. This allows a developer to use a single build and exercise separate code for testing versus production.

com.gosyntactix.cordova.testflightdetector

This plugin defines a global XCDetect object, which on app launch queries whether an app was installed via Xcodee. The launch from XCode works for both the Simulator and an attached USB device.

Although the object is in the global scope, it is not available until after the deviceready event.

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    console.log(XCDetect.isRunningXcode);
}

Installation

cordova plugin add https://github.com/rwillett/Cordova-Plugin---XCode-Detector.git

XCDetect.isRunningXcode

Returns true if the app was installed from XCode to an attached USB device or iOS Simulator.

Returns false if the app was installed via the official Apple App Store or TestFlight.

Supported Platforms

  • iOS

Quick Example

if (XCDetect.isRunningXcode) {
	//XCODE CODE HERE
} else {
	//PRODUCTION CODE HERE
}