Repository navigation
chore(ios): use projectToken initializer for native config - #87
Merged
Merged
Conversation
posthog-ios 4.0 removes the deprecated PostHogConfig(apiKey:host:) initializer. Switch to the equivalent init(projectToken:host:), available since posthog-ios 3.56.0. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
marandaneto
approved these changes
Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
posthog-ios 4.0 (PostHog/posthog-ios#873) removes the deprecated
PostHogConfig(apiKey:)/PostHogConfig(apiKey:host:)initializers. The iOS target was still building its native config throughapiKey:host:, so it would stop compiling once the posthog-ios dependency moves to 4.x.This swaps that one call to the equivalent
init(projectToken:host:), which has existed since posthog-ios 3.56.0 (we pin 3.64.1). The old initializer just forwarded to this one, so behaviour is unchanged.Not changed: posthog-kmp's own public
PostHogConfig.apiKeyparameter, the posthog-ios version, and every non-iOS target. I also checked the Apple source sets for the other APIs removed in 4.0 (nativeapiKeyproperty,propertiesSanitizer,evaluationEnvironments,remoteConfig,getFeatureFlagPayload, replaydebouncerDelay/maskPhotoLibraryImages) and found no other uses.💚 How did you test it?
./gradlew :posthog-kmp:compileKotlinIosArm64 :posthog-kmp:iosSimulatorArm64Testpasses./gradlew detektpassessample/iosAppthrough Xcode and ran it on an iOS Simulator only (iPhone 17). A physical iPhone was paired but locked, so no on-device run was done.PostHog.setupwith a dummy token and a host pointing at a local mock server, then captured one event and flushed.GET /array/<token>/config,POST /flags?v=2andPOST /batch, each carrying the configured token asapi_key; the batch contained the captured event. SDK debug logs showedbatch sent successfully.📝 Checklist
If releasing new changes
pnpm changeto generate a change intent file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
🤖 Generated with Claude Code