Closed husnainasghar closed 1 year ago
Hi @husnainasghar, BrazePushStory
and BrazeNotificationService
aren't set up as frameworks to be added directly into your project. They are extra libraries that can be added as target extensions.
The following guides should help you get started:
Hope this helps!
Hi @jerielng, I did follow the guides but when I try to add BrazePushStory
and BrazeNotificationService
framework to target they don't show up.
I have also tried to add these via Package Dependencies but in that case I get the following error:
Duplicate symbols for architecture x86_64 under Xcode
Hi @husnainasghar,
Flutter uses Cocoapods underneath the hood, and using a mix of Cocoapods and Swift Package Manager can lead to undefined behavior in iOS projects. Can you try importing the BrazePushStory
and BrazeNotificationService
frameworks via the Podfile
, similar to this snippet:
/* Rest of Podfile */
target 'YourAppPushNotificationsServiceExtension' do
platform :ios, '10.0'
pod 'BrazeNotificationService'
end
target 'YourAppPushNotificationsContentExtension' do
platform :ios, '10.0'
pod 'BrazePushStory'
end
I'm closing out this issue due to inactivity. If you continue to face issues, please contact support@braze.com with more context about your specific integration. Thank you!
Hi @hokstuff,
we have the same issue, but also tried adding the extension as a target in the podfile. We also had do add use_frameworks!
to make pod install
not error:
/* Rest of Podfile */
target 'PushServiceExtension' do
use_frameworks!
pod 'BrazeNotificationService'
end
But we still get this error
Error (Xcode): 130 duplicate symbols for architecture arm64
Could not build the application for the simulator. Error launching application on iPhone 14.
this also happens when we do
pod 'BrazeNotificationService', '~> 5.9.0'
Additionally in Xcode when using the Snippet from https://braze-inc.github.io/braze-swift-sdk/tutorials/braze/b2-rich-push-notifications/
import BrazeNotificationService
class NotificationService: BrazeNotificationService.NotificationService {}
we get this error:
NotificationService.swift:3:53 No type named 'NotificationService' in module 'BrazeNotificationService'
This seems to indicate another setup because when opening the BrazeNotificationService
declaration there is no NotificationService
specified, just this:
import SwiftOnoneSupport
import UIKit
import UserNotifications
import _Concurrency
import _StringProcessing
Hi @nottmey,
We also had do add use_frameworks! to make pod install not error:
Additionally in Xcode when using the Snippet from braze-inc.github.io/braze-swift-sdk/tutorials/braze/b2-rich-push-notifications ... we get this error:
This error seems to be a consequence of the first one. Resolving the first error should fix this one.
Hi @lowip, sure :)
When we add the following (changing iOS Version doesn't change the result),
target 'PushServiceExtension' do
platform :ios, '10.0'
pod 'BrazeNotificationService'
end
When we then use
target 'PushServiceExtension' do
use_frameworks!
platform :ios, '10.0'
pod 'BrazeNotificationService'
end
(see all the duplicate symbol
messages)
When I remove use_frameworks!
from target 'Runner'
it seems like the app starts, but I don't know whether this causes any issues (is Swift code even working then?). I'll need to check tomorrow, whether that would work out fine for us.
@nottmey,
Can you confirm that:
target 'PushServiceExtension' do
platform :ios, '10.0'
pod 'BrazeNotificationService'
end
is added at the root level of your Podfile? Adding it inside the target Runner
leads to it being compiled in the same compilation unit.
We're sharing some code between our main SDK (BrazeKit
) and the additional libraries (BrazeNotificationService
/ BrazePushStory
). Normally, those libraries should never be compiled in the same compilation target. Nesting a target inside another one in your Podfile implicitly mean that the child target is part of the same compilation unit as the parent target.
Additionally:
use_framework!
should not be required to use our SDKplatform :ios, '10.0'
is unsupported by both Flutter (iOS 11 minimum) and your Podfile (platform :ios, '12.0'
at the root level)
Yes @lowip,
our erroring Podfile with the snippet applied looks like this:
Do you know whether leaving out use_framework!
(which was in the initial project setup from the flutter cli) has any unwanted side-effects?
Thanks @nottmey for the different Podfiles.
The use_framework!
directive makes CocoaPods link against the dependencies dynamically instead of statically. This was a very common setting in the past, as Xcode did not support linking against Swift static libraries until Xcode 9.0 (released in 2018). It also helped to import Objective-C code into Swift projects by automatically generating the necessary headers / module maps to support Clang modules.
Five years later, Swift code is more predominant and the use_framework!
directive is less and less needed. The use_modular_headers!
directive (already included in your podfiles) also resolves the Objective-C import issue, and Xcode now fully supports linking against Swift static libraries.
Our SDKs are distributed as static libraries, as it is generally the best choice for launch time performance. Adding the use_framework!
directive re-package our SDK and all other dependencies into dynamic libraries, which can slow down your app launch time.
In our own testing, we haven't seen any unwanted side effects from linking the pods statically vs dynamically. I would nonetheless recommend a high level QA pass on your app to verify that this is the case on your side as well.
In the meantime, we're investigating possible change to our build process to avoid generating those duplicate symbols and make our integration more flexible.
Nice, thank you for the background info @lowip.
@nottmey I installed these via Swift Package Manager. You can follow the documentation using this link.
Initially, I was also facing duplicate symbols but then I only selected BrazePushStory
and BrazeNotificationService
from the checklist and it worked for me. I have attached an image for reference. From the checklist in the image, only BrazePushStory
and BrazeNotificationService
were selected in my case.
While adding rich notifications and push stories there are no BrazeNotificationService and BrazePushStory frameworks.
On running the app in the android studio it does not throw any errors and runs perfectly, but when I run the app from Xcode or try to make an archive it throws No such module 'BrazePushStory' and No such module 'BrazeNotificationService' errors.
I am using
braze_plugin: ^3.0.1
.