Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle Path Check Fails for Modularized App Structures on Real iOS Devices #858

Closed
mylifeasdog opened this issue Jan 18, 2024 · 0 comments
Closed
Labels
type:defect Bugs or weaknesses. The issue has to contain steps to reproduce.
Milestone

Comments

@mylifeasdog
Copy link
Contributor

mylifeasdog commented Jan 18, 2024

Describe the bug
The current implementation of UIViewController extension in Snowplow SDK uses a method swizzling technique to track screen views. It checks the bundle path to differentiate between the main app and system view controllers. However, in modularized app structures where different components of the app are separated into dynamic frameworks, this check fails on actual iOS devices. This is because the symbolic link between /private/var/ and /var/ leads to the main app bundle and framework bundles being treated differently, affecting tracking accuracy.

To Reproduce
Steps to reproduce the behavior:

  1. Create a modular iOS app where components are separated into different dynamic frameworks.
  2. Integrate Snowplow SDK for tracking screen views.
  3. Run the app on an actual iOS device.
  4. Observe that the screen views from dynamic frameworks are not tracked correctly.

Expected behavior
The Snowplow SDK should consistently track screen views across all parts of a modularized app, on both iOS simulators and actual devices. Specifically:

  • The SDK needs to resolve symbolic links in bundle paths. On real iOS devices, /private/var/ and /var/ are effectively the same due to symbolic linking, which is not accounted for in the current implementation.
  • By resolving these symbolic links, the SDK would accurately track view controllers in dynamic frameworks, ensuring reliable screen view tracking in modularized app architectures across different iOS environments.

Screenshots
Screenshot 2024-01-18 at 14 23 37
Screenshot 2024-01-18 at 14 29 43

Device information:

  • Device: iPhone14 Pro
  • OS: iOS17

Additional context
The issue seems to stem from the method sp_viewDidAppear in the SDK, which checks the bundle path prefix to filter out system view controllers. On real iOS devices, due to the symbolic link in the file system, this check incorrectly filters out view controllers from dynamically loaded frameworks. Specifically, the main app bundle path starting with /private/var/ and the dynamic framework paths starting with /var/ actually refer to the same physical location on the device's file system. This similarity in paths should be accounted for in the SDK's path check logic. A proposed solution involves modifying the path check to account for symbolic links and standardizing the paths before comparison.

@mylifeasdog mylifeasdog added the type:defect Bugs or weaknesses. The issue has to contain steps to reproduce. label Jan 18, 2024
mylifeasdog added a commit to mylifeasdog/snowplow-ios-tracker that referenced this issue Jan 18, 2024
mylifeasdog added a commit to mylifeasdog/snowplow-ios-tracker that referenced this issue Jan 18, 2024
mylifeasdog added a commit to mylifeasdog/snowplow-ios-tracker that referenced this issue Jan 18, 2024
mylifeasdog added a commit to mylifeasdog/snowplow-ios-tracker that referenced this issue Jan 18, 2024
@matus-tomlein matus-tomlein added this to the 6.0.0 milestone Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:defect Bugs or weaknesses. The issue has to contain steps to reproduce.
Projects
None yet
Development

No branches or pull requests

2 participants