larpon / QtFirebase

An effort to bring Google's Firebase C++ API to Qt + QML
MIT License
284 stars 83 forks source link

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

Open Markus87 opened 6 years ago

Markus87 commented 6 years ago

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?

larpon commented 6 years ago

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.

Markus87 commented 6 years ago

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.

larpon commented 6 years ago

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

I'll keep the issue open

adolby commented 5 years ago

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

driele-torres commented 3 years ago

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.

larpon commented 3 years ago

@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.