diff --git a/lib/pbxProject.js b/lib/pbxProject.js index 4701e9b..bd72497 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -217,13 +217,13 @@ pbxProject.prototype.removeFramework = function (fpath, opt) { if (opt) { if (opt.customFramework == true) { - this.removeFromFrameworkSearchPaths(path.dirname(fpath)); + this.removeFromFrameworkSearchPaths(file); } if (opt.embed == true) { - this.removePbxFromFrameworksBuildPhase(file); + this.removeFromPbxEmbedFrameworksBuildPhase(file, opt); } } - + return file; } @@ -269,10 +269,11 @@ pbxProject.prototype.removeFromPbxBuildFileSection = function (file) { if(this.pbxBuildFileSection()[uuid].fileRef_comment == file.basename) { file.uuid = uuid; delete this.pbxBuildFileSection()[uuid]; + + var commentKey = f("%s_comment", file.uuid); + delete this.pbxBuildFileSection()[commentKey]; } } - var commentKey = f("%s_comment", file.uuid); - delete this.pbxBuildFileSection()[commentKey]; } pbxProject.prototype.addToPbxFileReferenceSection = function (file) { @@ -412,21 +413,14 @@ pbxProject.prototype.addToPbxEmbedFrameworksBuildPhase = function (file) { embedFrameworks.files.push(pbxBuildPhaseObj(embedFile)); } -pbxProject.prototype.removeFromPbxEmbedFrameworksBuildPhase = function (file) { - var embedFile = new pbxFile(fpath); +pbxProject.prototype.removeFromPbxEmbedFrameworksBuildPhase = function (file, opt) { + var embedFile = new pbxFile(file.path); embedFile.group = 'Embed Frameworks'; var embedFrameworks = this.pbxEmbedFrameworksBuildPhaseObj(); for (var i in embedFrameworks.files) { - if (embedFrameworks.files[i].comment == longComment(file)) { - var uuid = embedFrameworks.files[i].uuid; - if (uuid in this.pbxBuildFileSection()) { - delete this.pbxBuildFileSection()[uuid]; - var commentKey = f("%s_comment", uuid); - delete this.pbxBuildFileSection()[commentKey]; - } - - sources.files.splice(i, 1); + if (embedFrameworks.files[i].comment == longComment(file, opt)) { + embedFrameworks.files.splice(i, 1); break; } } @@ -760,7 +754,10 @@ function pbxFileReferenceComment(file) { return file.basename; } -function longComment(file) { +function longComment(file, opt) { + if (opt && opt.embed == true) { + return f("%s in Embed %s", file.basename, file.group); + } return f("%s in %s", file.basename, file.group); }