QtFirebase icon indicating copy to clipboard operation
QtFirebase copied to clipboard

iOS - Should building QtFirebase with "QTFIREBASE_CONFIG += messaging" work?

Open Markus87 opened this issue 7 years ago • 6 comments

At the moment I only need the messaging component of QtFirebase. For my android build this was no problem. In order to make it work for iOS I needed to edit: https://github.com/Larpon/QtFirebase/blob/593032a7c613d40c55212ec10790400fd4a30c8f/qtfirebase_target.pri#L166

        LIBS += \
+           -F$$QTFIREBASE_FRAMEWORKS_ROOT/Analytics \
+           -framework GoogleUtilities \
+           -framework FirebaseCore \
+           -framework FirebaseInstanceID \
            -F$$QTFIREBASE_FRAMEWORKS_ROOT/Messaging \
            -framework FirebaseMessaging \
            -framework Protobuf \

I understand my solution is no general fix for the problem, but it works for me. Should this work out of the box?

Markus87 avatar Sep 04 '18 15:09 Markus87

Hi @Markus87 thanks for trying QtFirebase! - unfortunately it's not tested with individual components as such. The dependencies on iOS has been added in the order they were developed and later bug fixed. So your solution is perfectly sane. We're not always on top of things in this regard.

I guess standalone component support is easily fixed if LIBS += can contain duplicate entries. (Maybe you know if it's possible/allowed?)

On top of this we're fighting with Google changing dependencies around versus a lack of time to keep up atm.

larpon avatar Sep 04 '18 15:09 larpon

Thanks for the quick response. All fair enough - besides this little hickup QtFirebase already helped me a lot, so thanks for this great project. 👍

I guess standalone component support is easily fixed if LIBS += can contain duplicate entries.

Dont take my word for it, but I just added a few of the same frameworks more than once to LIBS and in the command line they only show up once. It looks like QMake handles it. Could not find any documentation regarding this behaviour though. So just trying to build the components one by one and fixing the errors could be the solution to standalone component support for iOS.

Markus87 avatar Sep 04 '18 16:09 Markus87

Cool - thanks for trying it out. Yup that's exactly what I had in mind!

I'll keep the issue open

larpon avatar Sep 04 '18 16:09 larpon

There is the *= operator which will prevent duplicates from being added to a variable. It looks like we might be able to use it to prevent adding duplicates to LIBS.

https://doc.qt.io/qt-5/qmake-language.html#adding-unique-values

It was my understanding that at one time Firebase Analytics (now called Firebase Core in the library name) was required as a minimum that was needed for other components but I think that the Firebase Team was working on refactoring that over the past year or so.

Update: It looks like Firebase Messaging doesn't require Firebase Core unless you want to use the Audiences feature to send messages, but I think that this is a recent change to Firebase to support this. The details are here:

Sharing Analytics data with Firebase features

adolby avatar Feb 27 '19 17:02 adolby

I think that I found out an error related to this. I cound`t compile using only "QTFIREBASE_CONFIG += messaging", instead it was necessary use "QTFIREBASE_CONFIG += analytics messaging". It was a linking error.

It was a hard time rsrs. For better understanding of my context: Qt Creator 4.13.1, QtVersion 5.14.2, Xcode Version 11.7 (11E801a), IOS 13.7 , Firebase C++ SDK 6.11.0 , Firebase IOS SDK Firebase iOS 6.28.2.

driele-torres avatar Sep 30 '20 16:09 driele-torres

@driele-torres Yes. The problem is that analytics also acts as the base for firebase (Google's choice). analytics should probably be made obligatory somehow.

larpon avatar Sep 30 '20 16:09 larpon