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]: Cannot compile app when migrating to Swift-SDK #64

Closed andestaerfan closed 1 year ago

andestaerfan commented 1 year ago

Platform

iOS

Platform Version

iOS: 14

Braze SDK Version

6.0.0

Xcode Version

14.3

Computer Processor

Apple (M1)

Repro Rate

100%

Steps To Reproduce

Example:

  1. Add braze-swift-sdk version 6.0.0 via Swift package manager
  2. Build the app.
  3. get this error on building:
  4. Screenshot 2023-05-25 at 18 15 21

    the

Expected Behavior

App can build!

Actual Incorrect Behavior

App cannot build!

Verbose Logs

No response

Additional Information

No response

jerielng commented 1 year ago

Hey @erfanandesta1373! Could you provide some additional details about your migration steps? Are you following the migration guide as described here?

If you are following the minimal migration steps, it appears that you may have a conflict with the old AppboyKit iOS SDK. Per the migration steps, you will need to remove the Appboy-iOS-SDK from your project and rely on using BrazeKitCompat instead.

If you are using the full migration steps, the migration will be a bit more involved, and you'll need to follow the Xcode errors and warnings to update your Braze method calls.

andestaerfan commented 1 year ago

Hey @jerielng as you can see in the image the error is in BrazeKitCompat. I followed the migration step and just stuck on compiling it after changing the import statements from Appboy to Braze. Right now there is no Appboy-iOS-SDK in the project.

jerielng commented 1 year ago

That's good to know, thanks! For this error specifically, and any others that arise due to deprecation, this is by design and is intended to prevent compilation until this method is migrated over. If you are calling this method in your application, can you update any instances of it to call this one instead:

- (void)registerApplication:(UIApplication *)application
    didReceiveRemoteNotification:(NSDictionary *)notification
          fetchCompletionHandler:
              (void (^)(UIBackgroundFetchResult))completionHandler;

It would look something like:

[self.braze registerApplication:application
      didReceiveRemoteNotification:notification
            fetchCompletionHandler:completionHandler];
andestaerfan commented 1 year ago

@jerielng that is really weird because I'm not using this method anywhere in the app!

jerielng commented 1 year ago

Thanks! If you aren't calling this method in your app, this shouldn't prevent a successful compilation. We may need some additional details about your integration to fully understand the issue here. Outside of this error, can you verify if there are any others in your build step that are showing up?

You also mentioned that you have removed AppboyKit from your project, integrated via SPM - Just to confirm, can you verify in your application's target under General -> Frameworks, Libraries, and Embedded Content that you are not seeing any traces of the old SDK (e.g. AppboyKit, AppboyUI, AppboyPushStory)?

image

and that it's also not appearing under your Package Dependencies in the sidebar?

image
andestaerfan commented 1 year ago

Thanks! If you aren't calling this method in your app, this shouldn't prevent a successful compilation. We may need some additional details about your integration to fully understand the issue here. Outside of this error, can you verify if there are any others in your build step that are showing up?

You also mentioned that you have removed AppboyKit from your project, integrated via SPM - Just to confirm, can you verify in your application's target under General -> Frameworks, Libraries, and Embedded Content that you are not seeing any traces of the old SDK (e.g. AppboyKit, AppboyUI, AppboyPushStory)? image and that it's also not appearing under your Package Dependencies in the sidebar? image

No, after I remove Appboy from the SPM there is no linked framework. I only have AppboySegment.

jerielng commented 1 year ago

AppboySegment is still using the legacy Appboy iOS SDK under the hood. We have it on our roadmap to productionize this updated library, which is using the latest Braze Swift SDK.

jerielng commented 1 year ago

Hi @erfanandesta1373, we've just released the productionized version of the Braze Plugin for Analytics Swift. This repo is located here and allows you to use the Braze Swift SDK in conjunction with Segment's Analytics-Swift library.

If you have any further questions, feel free to re-open the thread or start a new one. Thank you!