From 0f593c5134182e45c0351edb6bf05bc05f565467 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Mon, 19 Feb 2024 13:33:14 +0100 Subject: [PATCH 1/3] read app name from bundle display name as a fallback if bundle name isnt available --- CHANGELOG.md | 2 ++ PostHog.xcodeproj/project.pbxproj | 2 ++ PostHog/PostHogContext.swift | 2 ++ 3 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b9072f2b6..e046f59bb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Next +- read `$app_name` from `CFBundleDisplayName` as a fallback is `CFBundleName` isn't available [#107](https://github.com/PostHog/posthog-ios/pull/107) + ## 3.1.4 - 2024-02-19 - fix reset session when reset or close are called [#107](https://github.com/PostHog/posthog-ios/pull/107) diff --git a/PostHog.xcodeproj/project.pbxproj b/PostHog.xcodeproj/project.pbxproj index f5b3a46c04..e505da7913 100644 --- a/PostHog.xcodeproj/project.pbxproj +++ b/PostHog.xcodeproj/project.pbxproj @@ -1022,6 +1022,7 @@ DEVELOPMENT_TEAM = PNC2XCH2XP; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_CFBundleDisplayName = "$(PRODUCT_NAME)"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; @@ -1056,6 +1057,7 @@ DEVELOPMENT_TEAM = PNC2XCH2XP; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_CFBundleDisplayName = "$(PRODUCT_NAME)"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; diff --git a/PostHog/PostHogContext.swift b/PostHog/PostHogContext.swift index d9a2a8ed12..4f0c9149d5 100644 --- a/PostHog/PostHogContext.swift +++ b/PostHog/PostHogContext.swift @@ -26,6 +26,8 @@ class PostHogContext { if let appName = infoDictionary?[kCFBundleNameKey as String] { properties["$app_name"] = appName + } else if let appName = infoDictionary?["CFBundleDisplayName"] { + properties["$app_name"] = appName } if let appVersion = infoDictionary?["CFBundleShortVersionString"] { properties["$app_version"] = appVersion From a34f600467df7486efac67e57327dfe2ad9c7d7e Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Mon, 19 Feb 2024 13:34:30 +0100 Subject: [PATCH 2/3] fix --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e046f59bb0..471cba6012 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Next -- read `$app_name` from `CFBundleDisplayName` as a fallback is `CFBundleName` isn't available [#107](https://github.com/PostHog/posthog-ios/pull/107) +- read `$app_name` from `CFBundleDisplayName` as a fallback is `CFBundleName` isn't available [#108](https://github.com/PostHog/posthog-ios/pull/108) ## 3.1.4 - 2024-02-19 From 37f5e8c818b6fc46c8e9be62a07d646e251feaaa Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Mon, 19 Feb 2024 13:34:53 +0100 Subject: [PATCH 3/3] fix --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 471cba6012..63a7533f2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## Next -- read `$app_name` from `CFBundleDisplayName` as a fallback is `CFBundleName` isn't available [#108](https://github.com/PostHog/posthog-ios/pull/108) +- read `$app_name` from `CFBundleDisplayName` as a fallback if `CFBundleName` isn't available [#108](https://github.com/PostHog/posthog-ios/pull/108) ## 3.1.4 - 2024-02-19