1

From the recent release notes:

Bug Fixes and Performance Improvements — This release includes fix for 1) Swizzling ViewDidAppear 2) Keychain crash in iOS 15.* 3) Add namespacing to Encryption files in SFMCSDK 4) Library Evolution with Xcode 12.5 as minimum Xcode compatibility

Emphasis added for specific fix in question.

My team has concerns around a 3rd party SDK swizzling viewDidAppear since this affects the method implementation for the whole app not just the Salesforce SDKs. We only use the SDK for managing push contacts. Why is viewDidAppear being swizzled? Is this necessary or is there a way we can disable whatever functionality of the SDK is doing the swizzling? It seems a bit invasive for a 3rd party SDK to swizzle method implementations.

1 Answer 1

1

From what I can tell, viewDidAppear is swizzled as part of the behavioral analytic tracking features. The method responsible for this swizzle appears to be swizzleViewDidAppearForScreenTracking.

It's also noted that other push SDKs that do viewDidAppear swizzling may affect SFMCSDK:

Warning: If a push SDK uses method swizzling as a means of replacing iOS framework code at runtime, the MarketingCloudSDK may not work as expected.

To determine if an SDK uses swizzling, look for SDKs that do not use these methods:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfofetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler

Some SDKs offer a secondary implementation, which uses standard app delegate methods. If so, you must use the secondary implementation.

If you're not using the screen tracking feature, you should be able to safely disable this swizzle without loss of functionality.

4
  • Based on the link it is not clear how to disable or enable behavioral analytics tracking. It makes it sound like it is default analytic behavior. We do set .setAnalyticsEnabled(true) on the PushConfigBuilder. Does this mean behavioral analytics is enabled also? If so, in setting analytics to false, will that stop us from getting push open metrics?
    – Joey
    Apr 27, 2022 at 20:38
  • @Joey I don't know the specifics. I don't have XCode or a Mac. I actually tried to see if I could read the code, but it seems to be a binary file I can't open on Windows. If you can browse the SDK in XCode, it should be easy to figure out what it's doing. I'll see if I can get in touch with someone that might know more.
    – sfdcfox
    Apr 27, 2022 at 21:30
  • I can usually click through on a method in Xcode to get to the SDK headers, but Xcode cannot seem to resolve the method to the headers. This is with both Xcode 13.3.1 and 13.2.1.
    – Joey
    Apr 28, 2022 at 16:23
  • any update on this? We've discovered an issue with 8.0.3 in which the SDK is not functioning in App Store builds. I've verified updating the SDK fixes this, but we want to make sure we can disable any swizzling that is occurring. @sfdcfox
    – Joey
    May 2, 2022 at 18:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .