Repository navigation
4.0.0
·
4 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
Major Changes
-
0dbc224: To upgrade to posthog-ios 4.0.0 from 3.x.x, follow the migration guide.
- Breaking: stop publishing to CocoaPods. Install with Swift Package Manager (3.x.x versions stay on CocoaPods)
- Breaking: raise minimum deployment targets to iOS and Mac Catalyst 15.0, macOS 12.0, tvOS 15.0 and watchOS 10.0
- Breaking: require Xcode 26 or later (
swift-tools-version6.2) - Breaking: always record session replay as masked screenshots, which shows custom-drawn content and uses more bandwidth and CPU than wireframes. Remove
screenshotModeassignments and mask sensitive content withpostHogMask()orph-no-capture - Breaking: pass a
PostHogFeatureFlagsLoadedto thereloadFeatureFlags(_:)callback. Use{ result in ... }or{ _ in ... } - Breaking: mark
reloadFeatureFlags(_:),setBeforeSend(_:),getAnonymousId,pushIdentityProviderandlogSanitizercallbacks@Sendable, fixing a crash in Swift 6 apps - Breaking: rename
PostHogLogLeveltoPostHogConsoleLogLevelandPostHogLogEntrytoPostHogConsoleLogEntry - Breaking: return
nilinstead of the raw string for a malformed, empty or whitespace-only feature flag payload - Breaking: treat a feature flag whose variant is an empty string as disabled in
isFeatureEnabled,getFeatureFlagResult(_:).enabled,PostHogFeatureFlagsLoadedand$active_feature_flags - Breaking: stop decoding string payloads in
PostHogBootstrapConfig.featureFlagPayloadsa second time, so a bootstrapped"123"stays aString - Breaking: delete events still queued on disk by a 2.x.x SDK instead of sending them, and ignore a top-level
$setandmessage_idin queued events - Breaking: remove
versionandbuildfromApplication Installed,Application UpdatedandApplication Openedevents. Use$app_versionand$app_build - Breaking: remove
PostHogConfig.apiKey,PostHogConfig(apiKey:)andPostHogConfig(apiKey:host:). UseprojectToken,PostHogConfig(projectToken:)andPostHogConfig(projectToken:host:) - Breaking: remove
PostHogConfig.propertiesSanitizerandPostHogPropertiesSanitizer. UsesetBeforeSend(_:) - Breaking: remove
PostHogConfig.evaluationEnvironments. UseevaluationContexts - Breaking: remove the no-op
PostHogConfig.remoteConfigandPostHogSessionReplayConfig.maskPhotoLibraryImagesoptions - Breaking: remove
PostHogSDK.getFeatureFlagPayload(_:). UsegetFeatureFlagResult(_:sendFeatureFlagEvent:)?.payload - Breaking: remove
PostHogSessionReplayConfig.debouncerDelay. UsethrottleDelay - Breaking: remove background screenshot capture (
PostHogSessionReplayConfig.screenshotModeBackgroundCapture), which rendered off the main thread, so a frame could show content that had moved away from its mask. Delete the assignment, or usecaptureMethod = .gpu - Breaking: replace
PostHogSessionReplayConfig.screenshotModeGPUCapturewithcaptureMethod. UsecaptureMethod = .gpu - Breaking: remove the
PostHogSDK.didReceiveFeatureFlagsnotification. UseonFeatureFlags(_:) - Breaking: remove
PostHogDataMode.cellular. Use.any - Breaking: move
postHogSdkName,postHogVersion,PostHogConfig.snapshotEndpoint,PostHogSessionManager,PostHogStorageManager,PostHogConfig.storageManager,dateToMillis(_:)andimageToBase64(_:_:)behind@_spi(PostHogInternal). UsePostHogSDKsession and identity methods - Breaking: remove
toISO8601String(_:),toISO8601Date(_:),sanitizeDictionary(_:),deleteSafely(_:),postHogiOSSdkName,Gzip,GzipError,CompressionLevel,ReachabilityError,ReachabilityChangedNotification,UIColor.init(hex:)andUIColor.hexDescription(_:)from the public API - Breaking: send analytics events to capture V1 (
/i/v1/analytics/events) with the project token in anAuthorization: Bearerheader, replacing anyAuthorizationfromrequestHeaders. Update your reverse proxy to serve this path - Breaking: follow only 307 and 308 redirects to the same origin as
host, at most 5 times, and drop events on any other redirect - Breaking: drop an event whose distinct ID is over 200 UTF-8 bytes instead of shortening the ID
- Breaking: disable the SDK at setup when
projectTokenis a personal API key (phx_...). Use your project token (phc_...) - Breaking: pause sending for at most 30 seconds on
Retry-After, including session replay and logs - Breaking: send
$process_person_profile,$cookieless_mode,$ignore_sent_atand$product_tour_idas capture options, so PostHog drops an event whose option value it can't read - Breaking: let registered super properties override SDK properties such as
$os, and let super and event properties override$is_identified,$process_person_profile,$geoip_disableand the session replay debug values - Ignore a registered
$process_person_profileorprocess_person_profileoption on$identify,$create_alias,$merge_dangerously,$groupidentify,$setand$set_once, so a registeredfalsedoesn't stop identifying users - Breaking: fill
$liband$lib_versionas a pair after your properties, so a$libyou pass without$lib_versionis sent without one and a$lib_versionwithout$libis replaced - Breaking: let
userProperties,userPropertiesSetOnceandgroupswin key by key over$set,$set_onceand$groupspassed in the same call's properties - Breaking: rename
maxRetriestopushNotificationSubscriptionMaxRetries - Breaking: send
$session_idand$window_idas top-levelsession_idandwindow_idfields, and drop a value that isn't a string - Breaking: omit event properties whose value is
NSNullor aniloptional, including in nested dictionaries and dictionaries inside arrays, instead of sending them asnull.nullarray elements and$set,$set_onceand$group_setvalues are still sent - Breaking: let PostHog drop an event whose name is over 200 UTF-8 bytes, or whose distinct ID is empty or whitespace-only, instead of rejecting the whole batch
- Breaking: retry a capture request that gets a 404 and keep its events queued, with no fallback to
/batch, and stop retrying 3xx responses - Breaking: with
debugon, log capture failures as one line per batch with counts and PostHog's drop reasons, and stop logging each queued event and PostHog's response body. Update log-based alerts - Breaking: change
$localeto the device's preferred language with its region, such asde-CHinstead ofde. Filter on$app_languagefor the language the app shows - Breaking: mark error tracking stack frames from frameworks other than your app as not in-app by default. Append your own dynamic frameworks to
errorTrackingConfig.inAppIncludes(assigning it drops your app's own entries), or setinAppByDefault = truefor the 3.x.x behavior. Some existing error tracking issues may open as new issues after upgrading - Add per-event capture options with
capture(..., timestamp:options:)andPostHogEvent.options, also accepted byscreen,identify,setPersonProperties,alias,groupandcaptureException - Add
captureAi(...)to send AI events such as$ai_generationto/i/v1/ai/events, tuned withcaptureAiCompression,captureAiMaxQueueSize,captureAiTimeoutandcaptureAiMaxEventBytes - Add the
$app_languageproperty with the language the app displays, andsetAppLanguage(_:)to set it when the app translates some other way screenshotScaleis no longer experimental- Add
SessionReplay,CrashReportingandSurveysSwift package traits (on by default) that remove the feature and its public API when turned off - Add
isFeatureEnabled(_:defaultValue:)andisFeatureEnabled(_:defaultValue:sendFeatureFlagEvent:)to return a default you choose when a flag has no value - Add
PostHogSDK.setSdkName(_:version:)behind@_spi(PostHogInternal), exposed to Objective-C so wrapper SDKs that can't assignpostHogSdkNameandpostHogVersion, such as Kotlin Multiplatform, can report their own name and version - Add
registerOptionsForWrapper(_:)andunregisterOptionsForWrapper(_:)behind@_spi(PostHogInternal)so wrapper SDKs can register capture options sent with every event - Add compile errors that name the replacement, with an Xcode fix-it for renames, when Swift code uses most removed or renamed 3.x.x APIs
- Change the wait after a failed send to double from 1 second up to 30 seconds with jitter, for events, session replay and logs
- Change network reachability detection to
NWPathMonitor, so a path needing user action counts as reachable, queues pause while cellular data is off for the app, and early events may omit$network_wifiand$network_cellular - Change the replay screen name to the visible screen, reporting the view name for SwiftUI screens and no longer using a plain
UIViewController'stitle - Cap analytics batches at 5 MiB per request and send a larger event on its own
- Drop an event with an empty name before sending it, including one
beforeSendrenames to"" - Ignore
identifywith a whitespace-only distinct ID - Send a nested dictionary's number and boolean keys as strings instead of dropping the whole dictionary
- Use the current distinct ID for an empty or whitespace-only
distinctIdargument - Give each capture its own UUID, even when
beforeSendreturns an event kept from an earlier call - Print a warning, also without
debug, whensetupleaves the SDK disabled becauseprojectTokenis empty or a personal API key - Fix session replay recording nothing for apps whose window root is a SwiftUI view
- Fix secure-entry text fields being unmasked inside a
postHogNoMask()orph-no-masksubtree
Patch Changes
- 0dbc224: Stop sending a plain
UIViewController'stitleas the session replay screen name for frames captured through the Flutter native-screen bridge, matching other replay frames.