Skip to content

Commit 504d5da

Browse files
authored
chore: read $app_name from CFBundleDisplayName as a fallback if CFBundleName isn't available (#108)
1 parent a170455 commit 504d5da

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Next
22

3+
- read `$app_name` from `CFBundleDisplayName` as a fallback if `CFBundleName` isn't available [#108](https://github.com/PostHog/posthog-ios/pull/108)
4+
35
## 3.1.4 - 2024-02-19
46

57
- fix reset session when reset or close are called [#107](https://github.com/PostHog/posthog-ios/pull/107)

PostHog.xcodeproj/project.pbxproj

+2
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,7 @@
10221022
DEVELOPMENT_TEAM = PNC2XCH2XP;
10231023
ENABLE_PREVIEWS = YES;
10241024
GENERATE_INFOPLIST_FILE = YES;
1025+
INFOPLIST_KEY_CFBundleDisplayName = "$(PRODUCT_NAME)";
10251026
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
10261027
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
10271028
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
@@ -1056,6 +1057,7 @@
10561057
DEVELOPMENT_TEAM = PNC2XCH2XP;
10571058
ENABLE_PREVIEWS = YES;
10581059
GENERATE_INFOPLIST_FILE = YES;
1060+
INFOPLIST_KEY_CFBundleDisplayName = "$(PRODUCT_NAME)";
10591061
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
10601062
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
10611063
INFOPLIST_KEY_UILaunchScreen_Generation = YES;

PostHog/PostHogContext.swift

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class PostHogContext {
2626

2727
if let appName = infoDictionary?[kCFBundleNameKey as String] {
2828
properties["$app_name"] = appName
29+
} else if let appName = infoDictionary?["CFBundleDisplayName"] {
30+
properties["$app_name"] = appName
2931
}
3032
if let appVersion = infoDictionary?["CFBundleShortVersionString"] {
3133
properties["$app_version"] = appVersion

0 commit comments

Comments
 (0)