Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Help for Qt for iOS with AdMob implementation
Forum Updated to NodeBB v4.3 + New Features

Help for Qt for iOS with AdMob implementation

Scheduled Pinned Locked Moved Solved Mobile and Embedded
11 Posts 3 Posters 905 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Adla
    wrote on last edited by
    #1

    Hi,

    Can anyone please suggest an answer for my problem.

    I am developing an iOS app using Qt and trying to implement AdMob.

    I installed AdMob required frameworks using pod file, they are installed correctly and .xcworkspace has been successfully created.

    But when I run the build .xcworkspace file in Xcode, then it is showing the errors saying It can not find these frameworks.

    Is there anything I need to include in CMakeLists.txt file, please see CMakeLists.txt file.

    cmake_minimum_required(VERSION 3.16)
    
    project(testing VERSION 0.1 LANGUAGES CXX)
    
    set(CMAKE_AUTOMOC ON)
    
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    
    find_package(Qt6 6.5 REQUIRED COMPONENTS Quick Core Widgets)
    
    qt_standard_project_setup(REQUIRES 6.5)
    
    qt_add_executable(apptesting
        main.cpp
        AdMobManager.m
    )
    
    # qt_add_qml_module(apptesting
    #     URI testing
    #     VERSION 1.0
    #     QML_FILES
    #         Main.qml
    # )
    
    # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
    # If you are developing for iOS or macOS you should consider setting an
    # explicit, fixed bundle identifier manually though.
    set_target_properties(apptesting PROPERTIES
    #    MACOSX_BUNDLE_GUI_IDENTIFIER com.example.apptesting
        MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
        MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
        MACOSX_BUNDLE TRUE
        WIN32_EXECUTABLE TRUE
    )
    
    target_link_libraries(apptesting PUBLIC
        Qt6::Quick
        Qt6::Core
        Qt6::Widgets
        "-framework UIKit"
        "-framework FirebaseCore"
        "-framework GoogleMobileAds"
        )
        
    # Enable ARC for Objective-C++ files
    set_source_files_properties(AdMobManager.mm PROPERTIES COMPILE_FLAGS "-fobjc-arc")
    
    #set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_MODULES YES)
    
    include(GNUInstallDirs)
    
    install(TARGETS apptesting
        BUNDLE DESTINATION .
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    )
    
    qt_generate_deploy_qml_app_script(
        TARGET apptesting
        OUTPUT_SCRIPT deploy_script
        MACOS_BUNDLE_POST_BUILD
        NO_UNSUPPORTED_PLATFORM_ERROR
        DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
    )
    
    install(SCRIPT ${deploy_script})
    

    Also I did below changes in Xcode.

    • In my project's build settings:
    •  Add the /usr/lib/swift path to Runpath Search Paths.
      
    •  Add the -ObjC linker flag to Other Linker Flags.
      

    Thanks.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Adla
      wrote on last edited by
      #2

      Hi, Can someone please have a look at my problem.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Intuitively I would say that you have to tell cmake where to find these framework so it can properly configure the build system.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        A 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Intuitively I would say that you have to tell cmake where to find these framework so it can properly configure the build system.

          A Offline
          A Offline
          Adla
          wrote on last edited by
          #4

          @SGaist ,

          I downloaded Google Mobile Ads manually, and I updated the CMakeLists.txt file, but still it is not working.

          # Define the frameworks path
          set(FRAMEWORKS_DIR "${CMAKE_SOURCE_DIR}/ios_frameworks")
          
          # Add include directories
          target_include_directories(apptesting PUBLIC
              ${FRAMEWORKS_DIR}
          )
          
          # Link the frameworks explicitly
          target_link_libraries(apptesting PUBLIC
              "-framework GoogleMobileAds" 
              Qt6::Core
              Qt6::Quick
              Qt6::Widgets
          )
          
          # Link the framework search paths
          set(CMAKE_EXE_LINKER_FLAGS
              "${CMAKE_EXE_LINKER_FLAGS} -F${FRAMEWORKS_DIR}"
          )
          

          or

          should I consider the Google mobile ads which are in Pod in Xcode, but how can I use this location in CMakeLists.txt

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Adla
            wrote on last edited by
            #5

            Has anyone implemented AdMob on iOS using Qt ?, Are there any example projects that will give some ideas ?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              The folks at Felgo have a plug-in for AdMob.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              A 1 Reply Last reply
              0
              • SGaistS SGaist

                The folks at Felgo have a plug-in for AdMob.

                A Offline
                A Offline
                Adla
                wrote on last edited by
                #7

                @SGaist ,

                Thanks. got the answer I needed.

                1 Reply Last reply
                0
                • A Adla has marked this topic as solved on
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  What was it ? It might other people having the same issue as you.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1
                  • A Offline
                    A Offline
                    Adla
                    wrote on last edited by Adla
                    #9

                    I stored in GitHub, if anyone interested, you can have a look at it. Link below.

                    https://github.com/thirupathiadla/AdMob-for-iOS-with-Qt.git

                    Also, for Android link below.

                    https://github.com/thirupathiadla/AdMob-for-Qt-Android.git

                    S 1 Reply Last reply
                    1
                    • A Offline
                      A Offline
                      Adla
                      wrote on last edited by
                      #10

                      Does anyone know how to implement Firebase Core and Firebase Analytics for both Android and iOS using CMakeLists.txt in Qt ?

                      1 Reply Last reply
                      0
                      • A Adla

                        I stored in GitHub, if anyone interested, you can have a look at it. Link below.

                        https://github.com/thirupathiadla/AdMob-for-iOS-with-Qt.git

                        Also, for Android link below.

                        https://github.com/thirupathiadla/AdMob-for-Qt-Android.git

                        S Offline
                        S Offline
                        samdol
                        wrote last edited by samdol
                        #11

                        @Adla Thank you for sharing. GoogleMobileAds.framework in your Pods.zip works well.
                        May I ask you how you generated this Pods.zip?
                        I tried to generate it but it didn't work as yours.

                        Here is my steps.

                        1. Run Xcode
                        2. Create an iOS app project with
                          Interface: Storyboard
                          Language: Objective-C
                        3. pod init
                        4. Edit Podfile
                          pod 'Google-Mobile-Ads-SDK'
                        5. pod install --repo-update

                        But with the resulting GoogleMobileAds.framework, I got many errors,
                        Undefined symbols for architecture arm64:
                        "_$sBOWV", referenced from:
                        $s15GoogleMobileAds24GADMarketplaceKitSignalsCMf in GoogleMobileAds(GADMarketplaceKitSignals.o)
                        "
                        $sScA15unownedExecutorScevgTj", referenced from:
                        $sScTss5NeverORs_rlE8priority9operationScTyxABGScPSg_xyYaYAcntcfCyt_Tgmq5 in GoogleMobileAds(GADMarketplaceKitSignals.o)
                        "
                        $sScAMp", referenced from:
                        _symbolic ______pSg ScA in GoogleMobileAds(GADMarketplaceKitSignals.o)
                        ...

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved