braze-inc / braze-swift-sdk

Braze SDK for the Apple ecosystem, including: iOS, macOS, iPadOS, visionOS, tvOS
https://www.braze.com
Other
52 stars 19 forks source link

[Bug]: BrazePushStory Privacy manifest is missing the NSPrivacyCollectedDataTypes key #121

Closed scottlemke closed 7 months ago

scottlemke commented 7 months ago

Platform

iOS

Platform Version

iOS 17.4

Braze SDK Version

8.4.0

Xcode Version

Xcode 15.3

Computer Processor

Apple (M1)

Repro Rate

100% of the time

Steps To Reproduce

Generate a privacy report for an Archive build of an app that contains the BrazePushStory framework

Expected Behavior

The privacy report is generated without errors

Actual Incorrect Behavior

The privacy report is generated with an error at the bottom that states: Missing an expected key: 'NSPrivacyCollectedDataTypes' for BrazePushStory.framework

Verbose Logs

No response

Additional Information

No response

jerielng commented 7 months ago

Hey @scottlemke, thanks for raising this. We'll add the missing key to the manifest in the upcoming release and let you know when an updated version is available. As an aside, are you seeing any other errors being reported, or is this the only one being flagged when you submit to the App Store?

scottlemke commented 7 months ago

Hi, @jerielng. We haven't submitted a build to the store with this version of the SDK yet, but running it through the validation does not result in any other issues. This error is visible when you generate a privacy report in the Xcode organizer from an Archived build.

siparoma commented 7 months ago

@jerielng Is this related to the ITMS-91053: Missing API declaration issue of the braze push story?

8.4.0 is also continuously receiving warning emails.

ITMS-91053: Missing API declaration - Your app’s code in the “PlugIns/NotificationContentExtension.appex/NotificationContentExtension” file references one or more APIs that require reasons, including the following API categories: NSPrivacyAccessedAPICategoryUserDefaults. While no action is required at this time, starting May 1, 2024, when you upload a new app or app update, you must include a NSPrivacyAccessedAPITypes array in your app’s privacy manifest to provide approved reasons for these APIs used by your app’s code
jerielng commented 7 months ago

Hey @siparoma, this is a separate issue. We believe this missing API declaration warning email is being caused by an issue in App Store Connect, which is failing to read the privacy manifest data for frameworks linked statically.

We are actively looking into this, but as a workaround in the meantime, you can manually copy the API declarations we have listed in our published privacy manifests into your own app-level manifests. You will need to do this for any application target that imports either BrazeKit or BrazePushStory.

So for instance, if you are importing BrazeKit into your main application target and BrazePushStory into a notification service extension, you will need to add all the API declarations for BrazeKit into your main target’s privacy manifest, and all the API declarations for BrazePushStory into your extension’s privacy manifest.

kaoDev commented 7 months ago

Hi @jerielng, I just tried your proposed fix of copying the privacy manifest entries to our root app manifest. But I still get the error reported about the missing NSPrivacyCollectedDataTypes key in BrazePushStory

Errors Encountered Missing an expected key: 'NSPrivacyCollectedDataTypes' .../PlugIns/BrazeNotificationContent.appex/BrazePushStory.bundle/PrivacyInfo.xcprivacy

But also checking the privacy file for BrazePushStory in Sources/BrazePushStoryResources/Resources/PrivacyInfo.xcprivacy shows that there is no entry for NSPrivacyCollectedDataTypes, so I think the error is actually valid

kaoDev commented 7 months ago

adding the declarations to Pods/BrazePushStory/Sources/BrazePushStoryResources/Resources/PrivacyInfo.xcprivacy actually resolves the privacy report error

    <key>NSPrivacyCollectedDataTypes</key>
    <array>
      <dict>
        <key>NSPrivacyCollectedDataType</key>
        <string>NSPrivacyCollectedDataTypePreciseLocation</string>
        <key>NSPrivacyCollectedDataTypeLinked</key>
        <true/>
        <key>NSPrivacyCollectedDataTypeTracking</key>
        <false/>
        <key>NSPrivacyCollectedDataTypePurposes</key>
        <array>
          <string>NSPrivacyCollectedDataTypePurposeProductPersonalization</string>
          <string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
        </array>
      </dict>
      <dict>
        <key>NSPrivacyCollectedDataType</key>
        <string>NSPrivacyCollectedDataTypeCoarseLocation</string>
        <key>NSPrivacyCollectedDataTypeLinked</key>
        <true/>
        <key>NSPrivacyCollectedDataTypeTracking</key>
        <false/>
        <key>NSPrivacyCollectedDataTypePurposes</key>
        <array>
          <string>NSPrivacyCollectedDataTypePurposeProductPersonalization</string>
          <string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
        </array>
      </dict>
    </array>
kaoDev commented 7 months ago

@jerielng is there any progress? The deadline from apple gets closer and I would like to be able to create a build with no manual changes in the pod files

hokstuff commented 7 months ago

Hi @kaoDev,

Thanks for the ping and for posting the workaround in the PrivacyInfo.xcprivacy file mentioned above. We are currently validating a change in our private repo adding the missing NSPrivacyCollectedDataTypes to BrazePushStory and aim to get a version released by EOW or at the very latest prior to May 1. We will be in touch once this change is released.

kaoDev commented 7 months ago

thank you for the update 😊, looking forward to the update

hokstuff commented 7 months ago

Hi @scottlemke @kaoDev @siparoma,

We have released Swift SDK version 9.0.0 which adds the missing entry to BrazePushStory's privacy manifest. Feel free to comment back on this thread or contact support@braze.com if you still run into issues.

Thanks!