Update embed code
diff --git a/lib/pbxProject.js b/lib/pbxProject.js
index 4162747..02c6736 100644
--- a/lib/pbxProject.js
+++ b/lib/pbxProject.js
@@ -1057,19 +1057,9 @@
     var productName = targetName,
         productType = producttypeForTargettype(targetType),
         productFileType = filetypeForProducttype(productType),
-        productFile = this.addProductFile(productName, { 'target': targetUuid, 'group': 'CopyFiles' }),
+        productFile = this.addProductFile(productName, { 'target': targetUuid,  'explicitFileType': productFileType}),

         productFileName = productFile.basename;
 
-    // Product: Embed (only for "extension"-type targets)
-    if (targetType === 'app_extension') {
-
-        // Create "Copy Files" build phase for target which contains the extension
-        this.addBuildPhase([], 'PBXCopyFilesBuildPhase', 'CopyFiles', this.getFirstTarget().uuid)
-
-        // Add product reference to "Copy Files" build phase
-        this.addCopyfile(productFileName, { 'explicitFileType': productFileType, 'target': this.getFirstTarget().uuid })
-    };
-
     // Target: Create
     var target = {
             uuid: targetUuid,
@@ -1089,6 +1079,14 @@
     // Target: Add to PBXNativeTarget section
     this.addToPbxNativeTargetSection(target)
 
+    // Product: Embed (only for "extension"-type targets)

+    if (targetType === 'app_extension') {

+        // Create "Copy Files" build phase for target which contains the extension

+        this.addToPbxBuildFileSection(productFile);

+        var newPhase = this.addBuildPhase([productFileName], 'PBXCopyFilesBuildPhase', 'Copy Files', targetType)

+        this.addBuildPhaseToTarget(newPhase.buildPhase, this.getFirstTarget().uuid)

+    };

+

     // Target: Add uuid to root project
     this.addToPbxProjectSection(target);