Closed Imgkl closed 1 year ago
Great question! Thanks for asking.
When using our Flutter SDK today, there is some native code that is required. However, because you mentioned that you already have Firebase setup using dart, you may not need all of the native code.
While following the push setup instructions for our Flutter SDK, be sure to follow all of the instructions, including all of the native code setup. This includes the AppDelegate
instructions and creating a new target in Xcode and adding the NotificationService
class.
The only part that you could modify is FCM device token registration.
You can try to remove this native code from your app:
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
FirebaseApp.configure() // <-- remove this
Messaging.messaging().delegate = self // <-- remove this
}
// Remove this entire `extension AppDelegate: MessagingDelegate` block
extension AppDelegate: MessagingDelegate {
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
MessagingPush.shared.messaging(messaging, didReceiveRegistrationToken: fcmToken)
}
}
//
Then, in your dart code, when the Firebase SDK provides a device token to your app, send that device token to the CustomerIO Flutter SDK:
CustomerIO.registerDeviceToken(deviceToken: '<device token provided by Firebase SDK>')
All of the other native code is required to enable features such as opened
and delivered
push metrics.
This native code should not interfere with the dart Firebase SDK. Yes, the native code is the only way today to enable push metrics in a Flutter app.
@levibostian thanks I did tried what you mentioned with few modification to the code from the docs.
had to add use_frameworks!
in
target 'NotificationServiceExtention' do
use_frameworks!
pod 'CustomerIO/MessagingPushFCM', '~> 2.7.4'
end
Now I get this error. I guess flavors are messing with the rich notifications setup.
Error (Xcode): Cycle inside Runner; building could produce unreliable results.
Cycle details:
→ Target 'Runner': CodeSign /Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/Runner.app
○ That command depends on command in Target 'Runner': script phase “[CP] Embed Pods Frameworks”
○ That command depends on command in Target 'Runner': script phase “Copy GoogleServices.Plist depending on flavor”
○ That command depends on command in Target 'Runner': script phase “Thin Binary”
○ Target 'Runner' has process command with output '/Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/Runner.app/Info.plist'
○ Target 'Runner' has copy command from '/Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/NotificationServiceExtention.appex' to '/Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/Runner.app/PlugIns/NotificationServiceExtention.appex'
Raw dependency cycle trace:
target: ->
node: <all> ->
command: <all> ->
node: /Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/Runner.app/_CodeSignature ->
command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug-staging:CodeSign /Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/Runner.app ->
node: /Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/Runner.app/Frameworks/Alamofire.framework/ ->
directoryTreeSignature: � ->
directoryContents: /Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/Runner.app/Frameworks/Alamofire.framework ->
node: /Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/Runner.app/Frameworks/Alamofire.framework ->
command: P2:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug-staging:PhaseScriptExecution [CP] Embed Pods Frameworks /Users/Gokul/Library/Developer/Xcode/DerivedData/Runner-awnrwydsjbkumjewxzhtrvyqttwm/Build/Intermediates.noindex/Runner.build/Debug-staging-iphonesimulator/Runner.build/Script-DF6C8D67CA4379C61BADF79D.sh ->
node: /Users/Gokul/Library/Developer/Xcode/DerivedData/Runner-awnrwydsjbkumjewxzhtrvyqttwm/Build/Intermediates.noindex/Runner.build/Debug-staging-iphonesimulator/Runner.build/InputFileList-DF6C8D67CA4379C61BADF79D-Pods-Runner-frameworks-Debug-staging-input-files-b1fff4ece98ae9a5785cb17be7e36d0f-resolved.xcfilelist ->
command: P2:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug-staging:WriteAuxiliaryFile /Users/Gokul/Library/Developer/Xcode/DerivedData/Runner-awnrwydsjbkumjewxzhtrvyqttwm/Build/Intermediates.noindex/Runner.build/Debug-staging-iphonesimulator/Runner.build/InputFileList-DF6C8D67CA4379C61BADF79D-Pods-Runner-frameworks-Debug-staging-input-files-b1fff4ece98ae9a5785cb17be7e36d0f-resolved.xcfilelist ->
CYCLE POINT ->
node: <target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase5-copy-googleservices-plist-depending-on-flavor> ->
command: P0:::Gate target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase5-copy-googleservices-plist-depending-on-flavor ->
node: <execute-shell-script-18c1723432283e0cc55f10a6dcfd9e02e959943d87f407fd09b34c83311eb3e6-target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-> ->
command: P2:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug-staging:PhaseScriptExecution Copy GoogleServices.Plist depending on flavor /Users/Gokul/Library/Developer/Xcode/DerivedData/Runner-awnrwydsjbkumjewxzhtrvyqttwm/Build/Intermediates.noindex/Runner.build/Debug-staging-iphonesimulator/Runner.build/Script-5593BB0F26D17CDA00A0020C.sh ->
node: /Users/Gokul/Library/Developer/Xcode/DerivedData/Runner-awnrwydsjbkumjewxzhtrvyqttwm/Build/Intermediates.noindex/Runner.build/Debug-staging-iphonesimulator/Runner.build/Script-5593BB0F26D17CDA00A0020C.sh ->
command: P2:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug-staging:WriteAuxiliaryFile /Users/Gokul/Library/Developer/Xcode/DerivedData/Runner-awnrwydsjbkumjewxzhtrvyqttwm/Build/Intermediates.noindex/Runner.build/Debug-staging-iphonesimulator/Runner.build/Script-5593BB0F26D17CDA00A0020C.sh ->
node: <target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase4-thin-binary> ->
command: P0:::Gate target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase4-thin-binary ->
node: <execute-shell-script-18c1723432283e0cc55f10a6dcfd9e02f1eee2015e8ff5ebcd27678f788c2826-target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-> ->
command: P2:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug-staging:PhaseScriptExecution Thin Binary /Users/Gokul/Library/Developer/Xcode/DerivedData/Runner-awnrwydsjbkumjewxzhtrvyqttwm/Build/Intermediates.noindex/Runner.build/Debug-staging-iphonesimulator/Runner.build/Script-3B06AD1E1E4923F5004D2608.sh ->
node: /Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/Runner.app/Info.plist/ ->
directoryTreeSignature: r ->
directoryContents: /Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/Runner.app/Info.plist ->
node: /Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/Runner.app/Info.plist ->
command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug-staging:ProcessInfoPlistFile /Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/Runner.app/Info.plist /Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/ios/Runner/Info.plist ->
node: /Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/Runner.app/PlugIns/NotificationServiceExtention.appex ->
command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug-staging:Copy /Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/Runner.app/PlugIns/NotificationServiceExtention.appex /Users/Gokul/Downloads/Work Stuff/magnifi-mobile-app/build/ios/Debug-staging-iphonesimulator/NotificationServiceExtention.appex ->
node: <target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase6--cp--embed-pods-frameworks> ->
command: P0:::Gate target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase6--cp--embed-pods-frameworks ->
node: <target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase5-copy-googleservices-plist-depending-on-flavor>
Updated my iOS minimum deployment target to 14 as the pod's minimum deployment target was 14
The Customer.io SDK has a minimum target of 13. What SDK has a minimum target of 14?
had to add use_frameworks! in
This is quite common to add.
Now I get this error.
If I had to guess, coccoapods did not succeed in generating the Xcode workspace.
Could you run the command pod install --repo-update --project-directory=ios
in your project and send me the output of running that? It would also be helpful to see the contents of your Podfile
.
changed the minimum deployment target to 13.
Logs
Thanks for that information. That's very helpful.
Looking at the Podfile
you sent, this file seems similar to the Podfile
of our sample Flutter app. Therefore, I do not believe that Podfile
is causing this issue for you.
Could you provide more details what steps that you're taking to reproduce this issue? What steps are you taking or commands you're running to get to the error Error (Xcode):
?
No actually, after making all the changes outlined above and the docs. When I try to run the app, the build get failed with the above xcode error.
I suggest searching online for Flutter build flavors with a Notification Service Extension. Or, help with the error message that you received.
If that does not help, you could send us (win@customer.io
) a small demo Flutter application that reproduces this error. We can take a closer took from there.
Sure @levibostian.
the error looks like conflict between flavors and the native implementation of customer.io. Nothing wrong with the package, Closing this issue for now, Wil reopen If needed.
Hello,
I'm trying to setup rich notifications on iOS. Because I need metrics on delivered and opened. According to docs, I need to make native side changes. but I'm confused on one thing, we already have firebase messaging as our push provider and we initiate the firebase on dart side + requesting notification permissions on dart side. but the docs mentioned, to add these code
I'm confused on why this is needed, since I already do this on dart side,