From 63e3dd0f3d0b9ff0b4e8664dbe88113f5662b2f8 Mon Sep 17 00:00:00 2001 From: Ethan Neff Date: Wed, 1 Mar 2017 15:05:10 -0800 Subject: [PATCH] feat: no longer need to launch through Xcode to set provisioning profiles --- README.md | 10 ++-------- hooks/lib/ios/associatedDomains.js | 30 +++++++++++++++++++++++++----- testbed/init.sh | 2 +- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index c41d9732..732ff39b 100644 --- a/README.md +++ b/README.md @@ -227,11 +227,7 @@ - Delete your app from the device *(resets the Apple AASA scraping)* - - Compile your app *(`cordova build ios` `phonegap build ios` `ionic build ios`)* - - - Open the app in `Xcode` *(need to set your Provisioning Profile)* - - - Launch your app to a `device` *(not Simulator or TestFlight)* + - Compile your app *(`cordova run ios` `phonegap run ios` `ionic run ios`)* - Paste deep link in Apple Notes @@ -247,9 +243,7 @@ - Delete your app from the device - - Compile your app *(`cordova build android` `phonegap build android` `ionic build android`)* - - - Launch your app to a `device` *(not Simulator or Genymotion)* + - Compile your app *(`cordova run android` `phonegap run android` `ionic run android`)* - Paste deep link in Google Hangouts diff --git a/hooks/lib/ios/associatedDomains.js b/hooks/lib/ios/associatedDomains.js index a49fd586..3d9742a1 100644 --- a/hooks/lib/ios/associatedDomains.js +++ b/hooks/lib/ios/associatedDomains.js @@ -5,6 +5,7 @@ var fs = require('fs') var plist = require('plist') var mkpath = require('mkpath') + var BUILD_TYPES = ['Debug', 'Release'] var ASSOCIATED_DOMAINS = 'com.apple.developer.associated-domains' // entry @@ -14,12 +15,31 @@ // updates the associated domains from the link-domain field of the app's config.xml function addAssociatedDomains (preferences) { - var file = path.join(preferences.projectRoot, 'platforms', 'ios', preferences.bundleName, 'Resources', preferences.bundleName + '.entitlements') - var entitlements = getEntitlements(file) - console.log('BRANCH SDK: Updating iOS associated domains') - entitlements = updateEntitlements(entitlements, preferences) - setEntitlements(file, entitlements) + + var files = getEntitlementFiles() + for (var i = 0; i < files.length; i++) { + var file = files[i] + var entitlements = getEntitlements(file) + + entitlements = updateEntitlements(entitlements, preferences) + setEntitlements(file, entitlements) + } + } + + // get the xcode .entitlements and provisioning profile .plist + function getEntitlementFiles() { + var files = [] + var entitlements = path.join(preferences.projectRoot, 'platforms', 'ios', preferences.bundleName, 'Resources', preferences.bundleName + '.entitlements') + files.push(entitlements) + + for (var i = 0; i < BUILD_TYPES.length; i++) { + var buildType = BUILD_TYPES[i] + var plist = path.join(preferences.projectRoot, 'platforms', 'ios', preferences.bundleName, 'Entitlements-' + buildType + '.plist') + files.push(plist) + } + + return files } // save entitlements diff --git a/testbed/init.sh b/testbed/init.sh index 007bc7e0..56160d16 100755 --- a/testbed/init.sh +++ b/testbed/init.sh @@ -78,7 +78,7 @@ main() { # run if [[ "$run_ios" == "true" ]]; then - cordova build ios && open -a Xcode platforms/ios/Branch\ Testing.xcworkspace + cordova run ios --device fi if [[ "$run_and" == "true" ]]; then cordova run android