From 7cf40a4c184f667a8c72628111bdecde40db2312 Mon Sep 17 00:00:00 2001 From: JayShortway <29483617+JayShortway@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:01:11 +0100 Subject: [PATCH 1/2] Adds a post_install script to the KMP docs --- .../getting-started/installation/kmp_8.ruby | 16 ++++++++++++++++ .../installation/kotlin-multiplatform.mdx | 9 +++++++++ 2 files changed, 25 insertions(+) create mode 100644 code_blocks/getting-started/installation/kmp_8.ruby diff --git a/code_blocks/getting-started/installation/kmp_8.ruby b/code_blocks/getting-started/installation/kmp_8.ruby new file mode 100644 index 00000000..40020bd9 --- /dev/null +++ b/code_blocks/getting-started/installation/kmp_8.ruby @@ -0,0 +1,16 @@ +target 'iosApp' do + use_frameworks! + platform :ios, '16.0' + pod 'shared', :path => '../shared', :platforms => :ios + + # Add the following post_install script: + post_install do |installer| + installer.pods_project.targets.each do |target| + if target.name == 'shared' + target.build_configurations.each do |config| + config.build_settings.delete('ASSETCATALOG_COMPILER_APPICON_NAME') + end + end + end + end +end \ No newline at end of file diff --git a/docs/getting-started/installation/kotlin-multiplatform.mdx b/docs/getting-started/installation/kotlin-multiplatform.mdx index 48302d2b..da23aeb9 100644 --- a/docs/getting-started/installation/kotlin-multiplatform.mdx +++ b/docs/getting-started/installation/kotlin-multiplatform.mdx @@ -92,6 +92,15 @@ import cocoapodsGradle from "!!raw-loader!@site/code_blocks/getting-started/inst { type: 'kotlin', content: cocoapodsGradle, name: 'build.gradle.kts' } ]} /> +###### Missing app icon +In this scenario, if you get a compilation error at the `CompileAssetCatalog` step complaining about a missing app icon, add the following `post_install` script to your iOS app target in your `Podfile`. For instance, if your Kotlin Multiplatform module is named `shared`, it would look something like this: + +import podfilePostInstallContent from "!!raw-loader!@site/code_blocks/getting-started/installation/kmp_8.ruby"; + + + ### Set the correct launchMode for Android Depending on your user's payment method, they may be asked by Google Play to verify their purchase in their (banking) app. This means they will have to background your app and go to another app to verify the purchase. If your Activity's `launchMode` is set to anything other than `standard` or `singleTop`, backgrounding your app can cause the purchase to get cancelled. To avoid this, set the `launchMode` of your Activity to `standard` or `singleTop` in your Android app's `AndroidManifest.xml` file: From 6839ef880692a01d37417c04afb2ee3a4046e76f Mon Sep 17 00:00:00 2001 From: JayShortway <29483617+JayShortway@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:50:25 +0100 Subject: [PATCH 2/2] Recommends always adding the script --- docs/getting-started/installation/kotlin-multiplatform.mdx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/getting-started/installation/kotlin-multiplatform.mdx b/docs/getting-started/installation/kotlin-multiplatform.mdx index da23aeb9..2be8271e 100644 --- a/docs/getting-started/installation/kotlin-multiplatform.mdx +++ b/docs/getting-started/installation/kotlin-multiplatform.mdx @@ -92,8 +92,7 @@ import cocoapodsGradle from "!!raw-loader!@site/code_blocks/getting-started/inst { type: 'kotlin', content: cocoapodsGradle, name: 'build.gradle.kts' } ]} /> -###### Missing app icon -In this scenario, if you get a compilation error at the `CompileAssetCatalog` step complaining about a missing app icon, add the following `post_install` script to your iOS app target in your `Podfile`. For instance, if your Kotlin Multiplatform module is named `shared`, it would look something like this: +Finally, add the following `post_install` script to your iOS app target in your `Podfile`. For instance, if your Kotlin Multiplatform module is named `shared`, it should look something like this: import podfilePostInstallContent from "!!raw-loader!@site/code_blocks/getting-started/installation/kmp_8.ruby"; @@ -101,6 +100,8 @@ import podfilePostInstallContent from "!!raw-loader!@site/code_blocks/getting-st { type: 'ruby', content: podfilePostInstallContent, name: 'Podfile' } ]} /> +This avoids the compiler looking for an app icon in your Kotlin Multiplatform module. + ### Set the correct launchMode for Android Depending on your user's payment method, they may be asked by Google Play to verify their purchase in their (banking) app. This means they will have to background your app and go to another app to verify the purchase. If your Activity's `launchMode` is set to anything other than `standard` or `singleTop`, backgrounding your app can cause the purchase to get cancelled. To avoid this, set the `launchMode` of your Activity to `standard` or `singleTop` in your Android app's `AndroidManifest.xml` file: