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
10 Posts 2 Posters 654 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 5 Dec 2024, 20:43 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 6 Dec 2024, 19:57 last edited by
      #2

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

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 6 Dec 2024, 20:36 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 7 Dec 2024, 13:26
        0
        • S SGaist
          6 Dec 2024, 20:36

          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 7 Dec 2024, 13:26 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 7 Dec 2024, 14:52 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
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 7 Dec 2024, 15:59 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 12 Dec 2024, 12:22
              0
              • S SGaist
                7 Dec 2024, 15:59

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

                A Offline
                A Offline
                Adla
                wrote on 12 Dec 2024, 12:22 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 12 Dec 2024, 12:23
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 12 Dec 2024, 19:40 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 15 Dec 2024, 22:52 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

                    1 Reply Last reply
                    1
                    • A Offline
                      A Offline
                      Adla
                      wrote on 21 Dec 2024, 21:30 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

                      9/10

                      15 Dec 2024, 22:52

                      • Login

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