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]: duplicate symbols for architecture arm64 when using -ObjC flag #9

Closed azilbershtein closed 2 years ago

azilbershtein commented 2 years ago

Platform

iOS

Platform Version

15.5

Braze SDK Version

5.2.0

Xcode Version

13.4.1

Computer Processor

Apple (M1)

Repro Rate

100%

Steps To Reproduce

  1. Open project with -ObjC on the target level
  2. Add Braze via SPM - I use BrazeKit, BrazeUI and Braz
  3. You'll get the duplicate symbols error and the project won't compile Attaching an example app: TestApp.zip eNotificationService

Expected Behavior

Successful compilcation

Actual Incorrect Behavior

The project compilation failed

Verbose Logs

Too long to paste, thats the start of it:
duplicate symbol 'enum case for _BrazeAssetsClient.AssetsClient.FetchPolicy.cacheElseLoad(_BrazeAssetsClient.AssetsClient.FetchPolicy.Type) -> _BrazeAssetsClient.AssetsClient.FetchPolicy' in:
    /Users/azilbershtein/Library/Developer/Xcode/DerivedData/TestApp-bpaqwksyrjooaqgxyasdeygsestm/Build/Products/Debug-iphonesimulator/BrazeKit.framework/BrazeKit(BrazeKit-arm64-master.o)
    /Users/azilbershtein/Library/Developer/Xcode/DerivedData/TestApp-bpaqwksyrjooaqgxyasdeygsestm/Build/Products/Debug-iphonesimulator/BrazeNotificationService.framework/BrazeNotificationService(BrazeNotificationService-arm64-master.o)
duplicate symbol 'static _BrazeAssetsClient.AssetsClient.FetchPolicy.== infix(_BrazeAssetsClient.AssetsClient.FetchPolicy, _BrazeAssetsClient.AssetsClient.FetchPolicy) -> Swift.Bool' in:
    /Users/azilbershtein/Library/Developer/Xcode/DerivedData/TestApp-bpaqwksyrjooaqgxyasdeygsestm/Build/Products/Debug-iphonesimulator/BrazeKit.framework/BrazeKit(BrazeKit-arm64-master.o)
    /Users/azilbershtein/Library/Developer/Xcode/DerivedData/TestApp-bpaqwksyrjooaqgxyasdeygsestm/Build/Products/Debug-iphonesimulator/BrazeNotificationService.framework/BrazeNotificationService(BrazeNotificationService-arm64-master.o)
duplicate symbol '_BrazeAssetsClient.AssetsClient.FetchPolicy.hash(into: inout Swift.Hasher) -> ()' in:
    /Users/azilbershtein/Library/Developer/Xcode/DerivedData/TestApp-bpaqwksyrjooaqgxyasdeygsestm/Build/Products/Debug-iphonesimulator/BrazeKit.framework/BrazeKit(BrazeKit-arm64-master.o)
    /Users/azilbershtein/Library/Developer/Xcode/DerivedData/TestApp-bpaqwksyrjooaqgxyasdeygsestm/Build/Products/Debug-iphonesimulator/BrazeNotificationService.framework/BrazeNotificationService(BrazeNotificationService-arm64-master.o)
duplicate symbol '_BrazeAssetsClient.AssetsClient.FetchPolicy.policy.getter : __C.NSURLRequestCachePolicy' in:
    /Users/azilbershtein/Library/Developer/Xcode/DerivedData/TestApp-bpaqwksyrjooaqgxyasdeygsestm/Build/Products/Debug-iphonesimulator/BrazeKit.framework/BrazeKit(BrazeKit-arm64-master.o)
    /Users/azilbershtein/Library/Developer/Xcode/DerivedData/TestApp-bpaqwksyrjooaqgxyasdeygsestm/Build/Products/Debug-iphonesimulator/BrazeNotificationService.framework/BrazeNotificationService(BrazeNotificationService-arm64-master.o)

Additional Information

No response

lowip commented 2 years ago

Hi @azilbershtein, thanks for opening this issue.

The BrazeNotificationService module is not meant to be integrated in your main application. It should be added to a Notification Service Extension instead.

See our Rich Push Notifications tutorial and our PushNotifications / PushNotificationsServiceExtension Examples projects.

Your main application should link against:

Once you remove BrazeNotificationService from your main application, you will be able to compile it.

Best,

azilbershtein commented 2 years ago

Thanks. We have some question regarding migration from AppBoy, who can help with it?

lowip commented 2 years ago

Hi @azilbershtein,

Feel free to open a new issue here or email support@braze.com.