Skip to content

Commit ab08c91

Browse files
authored
Add CFBundleURLSchemes when building for iOS in debug. (#2863)
1 parent d3dbade commit ab08c91

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

lib/services/ios-project-service.ts

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,10 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
329329

330330
// build only for device specific architecture
331331
if (!buildConfig.release && !buildConfig.architectures) {
332-
await this.$devicesService.initialize({ platform: this.$devicePlatformsConstants.iOS.toLowerCase(), deviceId: buildConfig.device,
333-
isBuildForDevice: true });
332+
await this.$devicesService.initialize({
333+
platform: this.$devicePlatformsConstants.iOS.toLowerCase(), deviceId: buildConfig.device,
334+
isBuildForDevice: true
335+
});
334336
let instances = this.$devicesService.getDeviceInstances();
335337
let devicesArchitectures = _(instances)
336338
.filter(d => this.$mobileHelper.isiOSPlatform(d.deviceInfo.platform) && d.deviceInfo.activeArchitecture)
@@ -672,7 +674,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
672674
}
673675

674676
public async processConfigurationFilesFromAppResources(release: boolean, projectData: IProjectData): Promise<void> {
675-
await this.mergeInfoPlists(projectData);
677+
await this.mergeInfoPlists({ release }, projectData);
676678
await this.$iOSEntitlementsService.merge(projectData);
677679
await this.mergeProjectXcconfigFiles(release, projectData);
678680
for (let pluginData of await this.getAllInstalledPlugins(projectData)) {
@@ -704,7 +706,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
704706
return Promise.resolve();
705707
}
706708

707-
private async mergeInfoPlists(projectData: IProjectData): Promise<void> {
709+
private async mergeInfoPlists(buildOptions: IRelease, projectData: IProjectData): Promise<void> {
708710
let projectDir = projectData.projectDir;
709711
let infoPlistPath = path.join(projectDir, constants.APP_FOLDER_NAME, constants.APP_RESOURCES_FOLDER_NAME, this.getPlatformData(projectData).normalizedPlatformName, this.getPlatformData(projectData).configurationFileName);
710712
this.ensureConfigurationFileInAppResources();
@@ -745,7 +747,29 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
745747
<plist version="1.0">
746748
<dict>
747749
<key>CFBundleIdentifier</key>
748-
<string>${ projectData.projectId}</string>
750+
<string>${projectData.projectId}</string>
751+
</dict>
752+
</plist>`
753+
});
754+
}
755+
756+
if (!buildOptions.release && projectData.projectId) {
757+
session.patch({
758+
name: "CFBundleURLTypes from package.json nativescript.id",
759+
read: () =>
760+
`<?xml version="1.0" encoding="UTF-8"?>
761+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
762+
<plist version="1.0">
763+
<dict>
764+
<key>CFBundleURLTypes</key>
765+
<array>
766+
<dict>
767+
<key>CFBundleURLSchemes</key>
768+
<array>
769+
<string>${projectData.projectId.replace(/[^A-Za-z0-9]/g, "")}</string>
770+
</array>
771+
</dict>
772+
</array>
749773
</dict>
750774
</plist>`
751775
});

0 commit comments

Comments
 (0)