Skip to content

Commit

Permalink
fix: ShareExt.entitlments file
Browse files Browse the repository at this point in the history
  • Loading branch information
shajz committed Sep 10, 2024
1 parent 7cd11bc commit 5e7e609
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hooks/iosAddTarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function arrayFilterUnique(value, index, self) {

function addEntitlments(filePath, preferences) {
var plist = require('plist');
var plistContent = plist.parse(fs.readFileSync(filePath, 'utf8'));
var plistContent = fs.existsSync(filePath) ? plist.parse(fs.readFileSync(filePath, 'utf8')) : {};
var parent = 'com.apple.security.application-groups';
for (var i = 0; i < preferences.length; i++) {
var pref = preferences[i];
Expand Down Expand Up @@ -341,6 +341,10 @@ module.exports = function (context) {
// Add App Group to entitlments
addEntitlments(path.join(iosFolder(context), projectName, 'Entitlements-Debug.plist'), preferences);
addEntitlments(path.join(iosFolder(context), projectName, 'Entitlements-Release.plist'), preferences);
// ShareExt.entitlments is needed and must be linked to root project
addEntitlments(path.join(iosFolder(context), 'ShareExt.entitlements'), preferences);
var customTemplateKey = pbxProject.findPBXGroupKey({name: 'CustomTemplate'});
pbxProject.addFile('ShareExt.entitlements', customTemplateKey, { lastKnownFileType: 'text.plist.entitlements' });

//Add development team and provisioning profile
var PROVISIONING_PROFILE = getCordovaParameter(configXml, 'SHAREEXT_PROVISIONING_PROFILE');
Expand Down

0 comments on commit 5e7e609

Please sign in to comment.