Skip to content

Commit 3b06e60

Browse files
committed
fix: fix the tns build ios --for-device command failing with No .ipa file found in <some path> error message
The .ipa file is produced in `platforms/ios/build` folder but the {N} CLI searches it in `platfomrs/ios/build/Debug-iphoneos` folder
1 parent 0e40545 commit 3b06e60

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/services/ios-project-service.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,9 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
215215
* Returns the path to the .xcarchive.
216216
*/
217217
public async archive(projectData: IProjectData, buildConfig?: IBuildConfig, options?: { archivePath?: string, additionalArgs?: string[] }): Promise<string> {
218+
const platformData = this.getPlatformData(projectData);
218219
const projectRoot = this.getPlatformData(projectData).projectRoot;
219-
const archivePath = options && options.archivePath ? path.resolve(options.archivePath) : path.join(projectRoot, "/build/archive/", projectData.projectName + ".xcarchive");
220+
const archivePath = options && options.archivePath ? path.resolve(options.archivePath) : path.join(platformData.getBuildOutputPath(buildConfig), projectData.projectName + ".xcarchive");
220221
let args = ["archive", "-archivePath", archivePath, "-configuration",
221222
getConfigurationName(!buildConfig || buildConfig.release)]
222223
.concat(this.xcbuildProjectArgs(projectRoot, projectData, "scheme"));
@@ -287,12 +288,11 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
287288
/**
288289
* Exports .xcarchive for a development device.
289290
*/
290-
private async exportDevelopmentArchive(projectData: IProjectData, buildConfig: IBuildConfig, options: { archivePath: string, exportDir?: string, teamID?: string, provision?: string }): Promise<string> {
291+
private async exportDevelopmentArchive(projectData: IProjectData, buildConfig: IBuildConfig, options: { archivePath: string, provision?: string }): Promise<string> {
291292
const platformData = this.getPlatformData(projectData);
292293
const projectRoot = platformData.projectRoot;
293294
const archivePath = options.archivePath;
294-
const buildOutputPath = path.join(projectRoot, constants.BUILD_DIR);
295-
const exportOptionsMethod = await this.getExportOptionsMethod(projectData);
295+
const exportOptionsMethod = await this.getExportOptionsMethod(projectData, archivePath);
296296
let plistTemplate = `<?xml version="1.0" encoding="UTF-8"?>
297297
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
298298
<plist version="1.0">
@@ -320,7 +320,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
320320
this.$fs.writeFile(exportOptionsPlist, plistTemplate);
321321

322322
// The xcodebuild exportPath expects directory and writes the <project-name>.ipa at that directory.
323-
const exportPath = path.resolve(options.exportDir || buildOutputPath);
323+
const exportPath = path.resolve(path.dirname(archivePath));
324324
const exportFile = path.join(exportPath, projectData.projectName + ".ipa");
325325

326326
await this.xcodebuild(
@@ -1399,8 +1399,8 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
13991399
}
14001400
}
14011401

1402-
private getExportOptionsMethod(projectData: IProjectData): string {
1403-
const embeddedMobileProvisionPath = path.join(this.getPlatformData(projectData).projectRoot, constants.BUILD_DIR, "archive", `${projectData.projectName}.xcarchive`, 'Products', 'Applications', `${projectData.projectName}.app`, "embedded.mobileprovision");
1402+
private getExportOptionsMethod(projectData: IProjectData, archivePath: string): string {
1403+
const embeddedMobileProvisionPath = path.join(archivePath, 'Products', 'Applications', `${projectData.projectName}.app`, "embedded.mobileprovision");
14041404
const provision = mobileprovision.provision.readFromFile(embeddedMobileProvisionPath);
14051405

14061406
return {

0 commit comments

Comments
 (0)