Skip to content

Commit

Permalink
read app name from bundle display name as a fallback if bundle name i…
Browse files Browse the repository at this point in the history
…snt available
  • Loading branch information
marandaneto committed Feb 19, 2024
1 parent a170455 commit 0f593c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 2 additions & 0 deletions PostHog.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions PostHog/PostHogContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0f593c5

Please sign in to comment.