From 76233b2188fe7d5a4f1f2311199f087febe1f7c8 Mon Sep 17 00:00:00 2001 From: OS-ricardomoreirasilva Date: Mon, 9 Jan 2023 14:48:25 +0000 Subject: [PATCH] feat: Post_install for MABS 9 Add a `post_install` script to overcome an issue in Xcode 14 when Pods require a provisioning profile for code signing (such as Stripe). --- CHANGELOG.md | 3 +++ hooks/ios/iOSCopyPreferences.js | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43f3cc7..5d0286b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ The changes documented here do not include those from the original repository. ## [Unreleased] +## 09-01-2023 +- Fix: [iOS] Add `post_install` script to podfile in order to fix a XCode 14 code signing issue on Stripe's libraries. + ## 06-01-2023 - Feat: [iOS] Add access token to Full Payment Process (https://outsystemsrd.atlassian.net/browse/RMET-2147). diff --git a/hooks/ios/iOSCopyPreferences.js b/hooks/ios/iOSCopyPreferences.js index 0348636..404efc9 100644 --- a/hooks/ios/iOSCopyPreferences.js +++ b/hooks/ios/iOSCopyPreferences.js @@ -2,6 +2,7 @@ const et = require('elementtree'); const path = require('path'); const fs = require('fs'); const plist = require('plist'); +const child_process = require('child_process'); const { ConfigParser } = require('cordova-common'); const { Console } = require('console'); @@ -150,4 +151,21 @@ module.exports = function (context) { releaseEntitlements['com.apple.developer.in-app-payments'] = [merchant_id]; fs.writeFileSync(releaseEntitlementsPath, plist.build(releaseEntitlements, { indent: '\t' })); + + // Change podfile. + // This is included due to a bug on xCode 14 related with code signing for pods that require a provisioning profile. + var podfilePath = path.join(platformPath, 'Podfile'); + var podfileContents = fs.readFileSync(podfilePath).toString(); + podfileContents = podfileContents.concat(` +post_install do |installer| + installer.pods_project.targets.each do |target| + if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle" + target.build_configurations.each do |config| + config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO' + end + end + end +end`); + fs.writeFileSync(podfilePath, podfileContents); + child_process.execSync("pod install", { cwd: platformPath }); };