Skip to content

Commit bd81480

Browse files
committed
Update embed code
1 parent 2d1ce25 commit bd81480

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

lib/pbxProject.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,19 +1057,9 @@ pbxProject.prototype.addTarget = function(name, type) {
10571057
var productName = targetName,
10581058
productType = producttypeForTargettype(targetType),
10591059
productFileType = filetypeForProducttype(productType),
1060-
productFile = this.addProductFile(productName, { 'target': targetUuid, 'group': 'CopyFiles' }),
1060+
productFile = this.addProductFile(productName, { 'target': targetUuid, 'explicitFileType': productFileType}),
10611061
productFileName = productFile.basename;
10621062

1063-
// Product: Embed (only for "extension"-type targets)
1064-
if (targetType === 'app_extension') {
1065-
1066-
// Create "Copy Files" build phase for target which contains the extension
1067-
this.addBuildPhase([], 'PBXCopyFilesBuildPhase', 'CopyFiles', this.getFirstTarget().uuid)
1068-
1069-
// Add product reference to "Copy Files" build phase
1070-
this.addCopyfile(productFileName, { 'explicitFileType': productFileType, 'target': this.getFirstTarget().uuid })
1071-
};
1072-
10731063
// Target: Create
10741064
var target = {
10751065
uuid: targetUuid,
@@ -1089,6 +1079,14 @@ pbxProject.prototype.addTarget = function(name, type) {
10891079
// Target: Add to PBXNativeTarget section
10901080
this.addToPbxNativeTargetSection(target)
10911081

1082+
// Product: Embed (only for "extension"-type targets)
1083+
if (targetType === 'app_extension') {
1084+
// Create "Copy Files" build phase for target which contains the extension
1085+
this.addToPbxBuildFileSection(productFile);
1086+
var newPhase = this.addBuildPhase([productFileName], 'PBXCopyFilesBuildPhase', 'Copy Files', targetType)
1087+
this.addBuildPhaseToTarget(newPhase.buildPhase, this.getFirstTarget().uuid)
1088+
};
1089+
10921090
// Target: Add uuid to root project
10931091
this.addToPbxProjectSection(target);
10941092

0 commit comments

Comments
 (0)