Skip to content

Commit

Permalink
chore: read $app_name from CFBundleDisplayName as a fallback if `…
Browse files Browse the repository at this point in the history
…CFBundleName` isn't available (#108)
  • Loading branch information
marandaneto authored Feb 19, 2024
1 parent a170455 commit 504d5da
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 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)
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 504d5da

Please sign in to comment.