Skip to content

Commit

Permalink
feat: no longer need to launch through Xcode to set provisioning prof…
Browse files Browse the repository at this point in the history
…iles
  • Loading branch information
ethanneff committed Mar 1, 2017
1 parent 6bbdb37 commit 63e3dd0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
30 changes: 25 additions & 5 deletions hooks/lib/ios/associatedDomains.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion testbed/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 63e3dd0

Please sign in to comment.