diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 994f8a1754..0216e717cf 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -467,11 +467,8 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ } private async isDynamicFramework(frameworkPath: string): Promise { - const frameworkName = path.basename( - frameworkPath, - path.extname(frameworkPath) - ); - const isDynamicFrameworkBundle = async (bundlePath: string) => { + + const isDynamicFrameworkBundle = async (bundlePath: string, frameworkName: string) => { const frameworkBinaryPath = path.join(bundlePath, frameworkName); const fileResult = ( @@ -487,25 +484,29 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ if (path.extname(frameworkPath) === ".xcframework") { let isDynamic = true; - const subDirs = this.$fs - .readDirectory(frameworkPath) - .filter((entry) => - this.$fs.getFsStats(path.join(frameworkPath, entry)).isDirectory() - ); - for (const subDir of subDirs) { + const plistJson = this.$plistParser.parseFileSync(path.join(frameworkPath, 'Info.plist')); + for (const library of plistJson.AvailableLibraries) { const singlePlatformFramework = path.join( - subDir, - frameworkName + ".framework" + frameworkPath, + library.LibraryIdentifier, + library.LibraryPath ); if (this.$fs.exists(singlePlatformFramework)) { - isDynamic = await isDynamicFrameworkBundle(singlePlatformFramework); + const frameworkName = path.basename( + singlePlatformFramework, + path.extname(singlePlatformFramework) + ); + isDynamic = await isDynamicFrameworkBundle(singlePlatformFramework, frameworkName); break; } } - return isDynamic; } else { - return await isDynamicFrameworkBundle(frameworkPath); + const frameworkName = path.basename( + frameworkPath, + path.extname(frameworkPath) + ); + return await isDynamicFrameworkBundle(frameworkPath, frameworkName); } } @@ -518,7 +519,8 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ const project = this.createPbxProj(projectData); const frameworkAddOptions: IXcode.Options = { customFramework: true }; - if (await this.isDynamicFramework(frameworkPath)) { + const dynamic = await this.isDynamicFramework(frameworkPath); + if (dynamic) { frameworkAddOptions["embed"] = true; frameworkAddOptions["sign"] = true; }