diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b9072f2b..63a7533f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Next +- 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 - 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 f5b3a46c0..e505da791 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 d9a2a8ed1..4f0c9149d 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