Build, test, and submit your app using Xcode, Apple's integrated development environment.

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

EXC_BAD_ACCESS KERN_INVALID_ADDRESS ,Crashed: com.apple.main-thread
I am experiencing a crash on iOS 18 for some devices when the app becomes active again after being inactive for one or two days, with the following details: Crash Information: Thread: com.apple.main-thread Exception: EXC_BAD_ACCESS KERN_INVALID_ADDRESS The crash occurs intermittently on certain devices, but I haven’t been able to reproduce it consistently. Based on the crash logs, it seems to be related to accessing an invalid or corrupted memory address. But if user try to uninstall the app or restart the device, the issue is gone . Is this a known issue in iOS 18? Are there any official workarounds or fixes? Could this be related to specific device configurations, such as limited memory on older models? Are there any known APIs or frameworks in iOS 18 that could trigger such an issue? What additional debugging steps would you recommend to narrow down the root cause? Have other developers encountered similar crashes in iOS 18? Thank you for your help! I appreciate any insights or suggestions.
1
0
670
Dec ’24
Threads with classic lock-based synchronization in SwiftUI in Xcode 16
Hi, I am stuck moving one of my projects from Xcode 15 to Xcode 16. This is a SwiftUI application that uses in some places classic Threads and locks/conditions for synchronization. I was hoping that in Swift 5 mode, I could compile and run this app also with Xcode 16 so that I can start migrating it towards Swift 6. Unfortunately, my application crashes via EXC_BREAKPOINT (code=1, subcode=0x1800eb31c) whenever some blocking operation e.g. condition.wait() or DispatchQueue.main.sync { ... } is invoked from within the same module (I haven't seen this happening for frameworks that use the same code that I linked in dynamically). I have copied an abstraction below that I am using, to give an example of the kind of code I am talking about. I have verified that Swift 5 is used, "strict concurrency checking" is set to "minimal", etc. I have not found a workaround and thus, I'm curious to hear if others were facing similar challenges? Any hints on how to proceed are welcome. Thanks, Matthias Example abstraction that is used in my app. It's needed because I have synchronous computations that require a large stack. It's crashing whenever condition.wait() is executed. public final class TaskSerializer: Thread { /// Condition to synchronize access to `tasks`. private let condition = NSCondition() /// The tasks queue. private var tasks = [() -> Void]() public init(stackSize: Int = 8_388_608, qos: QualityOfService = .userInitiated) { super.init() self.stackSize = stackSize self.qualityOfService = qos } /// Don't call directly; this is the main method of the serializer thread. public override func main() { super.main() while !self.isCancelled { self.condition.lock() while self.tasks.isEmpty { if self.isCancelled { self.condition.unlock() return } self.condition.wait() } let task = self.tasks.removeFirst() self.condition.unlock() task() } self.condition.lock() self.tasks.removeAll() self.condition.unlock() } /// Schedule a task in this serializer thread. public func schedule(task: @escaping () -> Void) { self.condition.lock() self.tasks.append(task) self.condition.signal() self.condition.unlock() } }
1
0
390
Dec ’24
I get this Issue : ContentView.swift:3016:25 The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions. But I don´t know what I have to do. I am a noob. Can anybody help me.
// Füge OrderRow hinzu struct OrderRow: View { let order: Order var body: some View { VStack(alignment: .leading, spacing: 8) { HStack { Text("Tisch \(order.tableNumber)") .font(.headline) Spacer() Text(order.status.rawValue) .font(.caption) .padding(.horizontal, 8) .padding(.vertical, 4) .background(order.status.color.opacity(0.2)) .foregroundColor(order.status.color) .cornerRadius(8) } Text(order.timestamp, style: .time) .font(.caption) .foregroundColor(.gray) ForEach(order.items) { item in Text("\(item.quantity)x \(item.item.name)") .font(.subheadline) } HStack { Spacer() Text(String(format: "%.2f €", order.totalAmount)) .bold() } } .padding() .background(Color.white) .cornerRadius(12) .shadow(radius: 2) } } struct MenuItemRow: View { let item: MenuItem var body: some View { HStack { Text(item.name) .font(.headline) Spacer() Text(String(format: "%.2f €", item.price)) .font(.subheadline) } .padding() } } struct MenuItemsView: View { @Binding var selectedItems: [OrderItem] @Environment(.dismiss) private var dismiss func filteredItems(for category: MenuCategory) -> [MenuItem] { return sampleMenuItems.filter { $0.category == category } } func addItemToOrder(_ item: MenuItem) { if let index = selectedItems.firstIndex(where: { $0.item.id == item.id }) { selectedItems[index].quantity += 1 } else { selectedItems.append(OrderItem(item: item, quantity: 1)) } } var body: some View { NavigationView { List { ForEach(MenuCategory) { category in Section(header: Text(category.rawValue)) { let filteredItems = sampleMenuItems.filter ForEach(filteredItems) { item in } MenuItemRow(item: sampleMenuItems.filter) { addItemToOrder } } } } } .navigationTitle("Menü") .toolbar { ToolbarItem(placement: .navigationBarTrailing) { Button("Fertig") { dismiss() } } } } } } // Sample Menü-Items let sampleMenuItems: [MenuItem] = [ MenuItem(name: "Cola", description: "0,33l", price: 3.50, category: .drinks, image: "cola"), MenuItem(name: "Sprite", description: "0,33l", price: 3.50, category: .drinks, image: "sprite"), MenuItem(name: "Bier", description: "0,5l", price: 4.00, category: .drinks, image: "beer"), MenuItem(name: "Nachos", description: "mit Käsesauce", price: 5.50, category: .snacks, image: "nachos"), MenuItem(name: "Pommes", description: "mit Ketchup", price: 4.50, category: .food, image: "fries"), MenuItem(name: "********", description: "alkoholfrei", price: 6.50, category: .specials, image: "********") ] struct NewEventView: View { var body: some View { Text("New Event") } } struct EventManagementView: View { var body: some View { Text("Event Management") } } struct OrderRow: View { var order: String var body: some View { Text("Order: (order)") } } #Preview { ContentView() }
4
0
541
Dec ’24
xctrace symbolizes that the command running result does not meet expectations
When I use the xctrace symbolize command to symbolize a trace file, the command runs normally and ends, but only part of the stack is symbolized in the generated symbolized trace file. If I use Instruments to open the symbolized trace file, I will see the symbolized status of the corresponding library in the symbols window as Awaiting Resymbolication.
1
1
338
Dec ’24
dyld: Symbol not found: _$sSo18OS_dispatch_sourceC8DispatchE19MemoryPressureEventVs23CustomStringConvertibleACMc
Upgraded Xcode from 15.2 to 16. App runs properly on iOS 18 Simulator for Xcode 16 but crashes on iOS 17.5, 17.4 & 17.2 immediately after build successfully. dyld[60620]: Symbol not found: _$sSo18OS_dispatch_sourceC8DispatchE19MemoryPressureEventVs23CustomStringConvertibleACMc Referenced from: <59369128-9EA5-3CF7-8CCF-7C754D9EE639> /Users/siddheshwarashokkathale/Library/Developer/CoreSimulator/Devices/E18F8D1F-764C-4491-B471-5BBB52A327EF/data/Containers/Bundle/Application/A257613C-3000-41F6-92EF-287E45D3A9D5/Arch.app/Arch.debug.dylib Expected in: <5E0473C0-C3FF-3BFB-9712-1CFB1372EA49> /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/libswiftDispatch.dylib Message from debugger: Terminated due to signal 6
4
4
633
Dec ’24
Xcode C++ Header Error ('climits' not found)
Hello, I am working on a Flutter package and need to integrate OpenCV. I generated an XCFramework and linked it through the .podspec file. However, I am encountering an error where Xcode does not seem to recognize some C++ headers, even though I added the necessary configurations in the .podspec. Here is what I included in my .podspec: s.xcconfig = { 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14', 'CLANG_CXX_LIBRARY' => 'libc++', "SWIFT_OBJC_INTEROP_MODE" => "objcxx", } s.preserve_paths = 'opencv2.xcframework' s.vendored_frameworks = 'opencv2.xcframework' s.frameworks = 'AVFoundation' s.library = 'c++' When running the project in Xcode, I encounter this error: error: 'climits' file not found This error is triggered by one of the headers in the OpenCV library. I am using Xcode 16.1
1
1
365
Dec ’24
Unstable `archive` for `Debug` configuration (ld: file cannot be open()ed, errno=2)
We have a relatively big iOS-only project with around 80 build targets from swift packages (local features and external project dependencies) and Xcode 15.4 (originally, migrated to 16.0). Project compiles and runs great, but xcodebuild archive will fail 4 out of 5 tries with this: ld: file cannot be open()ed, errno=2 path=/opt/builds/fLLyxmhG/0/myapp/Build/Intermediates.noindex/ArchiveIntermediates/myapp (Development Flow)/BuildProductsPath/Debug-iphonesimulator/Account.o in '/opt/builds/fLLyxmhG/0/myapp/Build/Intermediates.noindex/ArchiveIntermediates/myapp (Development Flow)/BuildProductsPath/Debug-iphonesimulator/Account.o' Where Account.o is an end product of one of our feature packages linking to an .app itself. This error is not tied to this concrete package/product (which should be compiling almost last relative to build graph) and could appear mid-build in between our service layer packages. It seems (and is approved by Xcode timeline for .app archive log) that module dependency is compiled later than module itself and linker just cant find its dependency object files. The scheme is: Module A (dependency itself) Module B (needs module A) And with build order expected (???) to be A (first) -> B we're getting the B -> A. Error appears only when archiving for Debug configuration, archiving the same end-target with Release configuration results in stable passes 10 out of 10 tries. Setting identical parameters in Build Settings tab for both configurations of a target is not giving any effect. Our current fix is choosing Manual order in scheme Build order setting. Everything works as expected, but i guess it's not optimal 🤧 Sadly can't provide test project, but anything else — welcome.
0
1
428
Dec ’24
objc_msgSend crash
My app experiencing a rare crash that I am unable to reproduce and am struggling to make progress with: Thread 0 name: Thread 0 Crashed: 0 libobjc.A.dylib 0x00000001926c3c20 objc_msgSend + 32 (:-1) 1 Foundation 0x00000001997357b4 __NSThreadPerformPerform + 264 (NSThread.m:1084) 2 CoreFoundation 0x000000019a82b834 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1957) 3 CoreFoundation 0x000000019a82b7c8 __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2001) 4 CoreFoundation 0x000000019a8292f8 __CFRunLoopDoSources0 + 340 (CFRunLoop.c:2046) 5 CoreFoundation 0x000000019a828484 __CFRunLoopRun + 828 (CFRunLoop.c:2955) 6 CoreFoundation 0x000000019a827cd8 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420) 7 GraphicsServices 0x00000001df2751a8 GSEventRunModal + 164 (GSEvent.c:2196) 8 UIKitCore 0x000000019ce61ae8 -[UIApplication _run] + 888 (UIApplication.m:3713) 9 UIKitCore 0x000000019cf15d98 UIApplicationMain + 340 (UIApplication.m:5303) 10 <redacted> 0x000000010287af04 main + 64 (AppDelegate.swift:15) 11 dyld 0x00000001bdfff154 start + 2356 (dyldMain.cpp:1298) I have done a fair amount of digging, looking at other similar crashes and at this: https://developer.apple.com/forums/thread/92102 but being unable to reproduce is quite limiting. I found this very similar issue with useful info on finding which function was being called: https://forums.developer.apple.com/forums/thread/67763 But in my case, the x1 (and x2) register values seem to point to an area outside of the ranges in the "Binary Images" section.. I've attached an example of a full crash report (with the app name redacted): 2024-10-30_20-44-26.7576_+0000-98e2ef3ee4472b9eb237b0780e8fa0162e1aa7f4.crash Any help would be greatly appreciated.
4
2
794
Dec ’24
Live Activity Dissappearing
Hello, I am experiencing an issue with the Live Activity feature in my application. Despite extensive debugging efforts, the problem persists, and I would greatly appreciate your assistance. Here are the key details of the issue: We are not using APNS; everything related to Live Activities is handled locally within the app. The Live Activity displays task details, including: Task title, icon and A label functioning as a timer that shows the remaining time in seconds for the task. The Live Activity appears as expected when the app is opened. However, when the app is sent to the background, the Live Activity does not appear consistently. It disappears unexpectedly in some random instances. I have tried various debugging methods, including: Ensuring the activity is correctly created and updated as per the Apple Documentation. Verifying the ActivityAttributes and ActivityContentState configurations. Testing with different app lifecycle events to determine when the issue occurs. Despite these efforts, the issue remains unresolved, and the cause is unclear. The app behavior seems inconsistent, as the Live Activity sometimes remains visible and at other times disappears when the app is backgrounded. I would greatly appreciate your help in understanding and addressing this issue. Specifically: Are there any system-level constraints or conditions that could cause a Live Activity to terminate when the app is backgrounded? Are there best practices or configurations to ensure the persistence of locally managed Live Activities? Can you suggest additional debugging techniques or tools that could help identify the root cause? Thank you for your time and support. Please let me know if further information or logs are needed to assist in troubleshooting
1
0
491
Dec ’24
Xcode crashed after last update 18.2
i don't know if the crash happened because of the system update or not but now when i try to open it its completely crash , here is the error , Translated Report (Full Report Below) Process: Xcode [1067] Path: /Applications/Xcode.app/Contents/MacOS/Xcode Identifier: com.apple.dt.Xcode Version: 16.1 (23503) Build Info: IDEApplication-23503000000000000~2 (16B40) App Item ID: 497799835 App External ID: 869932297 Code Type: ARM-64 (Native) Parent Process: launchd [1] User ID: 501 Date/Time: 2024-11-30 11:10:55.9269 +0100 OS Version: macOS 15.2 (24C5089c) Report Version: 12 Anonymous UUID: C79C335A-F74F-AE24-F4A0-C185D480C480 Time Awake Since Boot: 160 seconds System Integrity Protection: enabled Crashed Thread: 16 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6 Terminating Process: Xcode [1067] Application Specific Information: abort() called Application Specific Signatures: __objc_no Thread 0:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x1876def34 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x1876f15e4 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x1876e7ad8 mach_msg_overwrite + 480 3 libsystem_kernel.dylib 0x1876df27c mach_msg + 24 4 CoreFoundation 0x187808a3c __CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x18780729c __CFRunLoopRun + 1212 6 CoreFoundation 0x187806724 CFRunLoopRunSpecific + 588 7 HIToolbox 0x192d65530 RunCurrentEventLoopInMode + 292 8 HIToolbox 0x192d6b348 ReceiveNextEventCommon + 676 9 HIToolbox 0x192d6b508 _BlockUntilNextEventMatchingListInModeWithFilter + 76 10 AppKit 0x18b371034 _DPSNextEvent + 660 11 AppKit 0x18bcd52d4 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688 12 AppKit 0x18b364060 -[NSApplication run] + 480 13 IDEKit 0x10579c798 -[IDEApplication run] + 60 14 AppKit 0x18b33a854 NSApplicationMain + 888 15 dyld 0x1873a0274 start + 2840 Thread 1:: Dispatch queue: com.apple.dt.IDESourceControlTree.FileStatusQueue 0 libsystem_kernel.dylib 0x1876e0c8c __ulock_wait + 8 1 libdispatch.dylib 0x18756dfa4 _dlock_wait + 56 2 libdispatch.dylib 0x18756dca0 _dispatch_wait_on_address + 140 3 libdispatch.dylib 0x18756e374 _dispatch_group_wait_slow + 56 4 IDEFoundation 0x109fe90c8 -[IDESourceControlWorkingTreeUpdater _fileStatusQueue_fetchStatusForEntireWorkingCopyWithRemoteStatus:error:] + 384 5 IDEFoundation 0x109fe8ef8 __97-[IDESourceControlWorkingTreeUpdater fetchStatusForEntireWorkingCopyWithRemoteStatus:completion:]_block_invoke + 116 6 libdispatch.dylib 0x18756b854 _dispatch_call_block_and_release + 32 7 libdispatch.dylib 0x18756d5b4 _dispatch_client_callout + 20 8 libdispatch.dylib 0x187574bd8 _dispatch_lane_serial_drain + 768 9 libdispatch.dylib 0x187575730 _dispatch_lane_invoke + 380 10 libdispatch.dylib 0x1875809a0 _dispatch_root_queue_drain_deferred_wlh + 288 11 libdispatch.dylib 0x1875801ec _dispatch_workloop_worker_thread + 540 12 libsystem_pthread.dylib 0x18771c3d8 _pthread_wqthread + 288 13 libsystem_pthread.dylib 0x18771b0f0 start_wqthread + 8 Thread 2: 0 libsystem_pthread.dylib 0x18771b0e8 start_wqthread + 0 Thread 3:: Dispatch queue: SDK Loading 0 libswiftCore.dylib 0x1988ea27c swift_unknownObjectRelease + 36 1 libswiftCore.dylib 0x1986d0f58 String.init(cocoaString:) + 44 2 Foundation 0x188cdbc14 static String.unconditionallyBridgeFromObjectiveC(:) + 712 3 SymbolCacheSupport 0x1277466ec @objc Buffer.string() + 28 4 SourceModel 0x125974f40 -[SMSourceModel textOfItem:] + 56 5 SymbolCacheSupport 0x1277cdfdc SMSourceModel.splitIntoStatements(:splitOnNewLine:) + 748 6 SymbolCacheSupport 0x127707eb8 ObjCSourceModelExtractor.body(children:) + 484 7 SymbolCacheSupport 0x127878b2c ObjcToSwiftFileTranslator.init(fileInfo:symbolCache:isSystemModule:options:platformFilter:importErrorAsBridgedStoredNSError:) + 644 8 SymbolCacheSupport 0x1275ee49c ClangToSwiftModuleImporter.import(moduleData:importData:allAPINotes:directoryURL:relativeBasePath:) + 3056 9 SymbolCacheSupport 0x127761e10 ClangModuleImporter.import(dependencyRetriever:recursiveAPINotes:type:relativeBasePath:) + 3060 10 SymbolCacheSupport 0x127703020 ModuleImporter.importSystemModule(:) + 1468 11 SymbolCacheSupport 0x1277026e0 ModuleImporter.import(:) + 980 12 SymbolCacheSupport 0x127705684 ModuleImporter.importObjcDependencyImport(:) + 692 13 SymbolCacheSupport 0x12774894c specialized collectDependencies #1 (:) in SymbolCacheSDKStorage.indexedModule(type:dependencyRetriever:) + 512 14 SymbolCacheSupport 0x127747a38 specialized SymbolCacheSDKStorage.indexedModule(type:dependencyRetriever:) + 1156 15 SymbolCacheSupport 0x12770236c ModuleImporter.import(:) + 96 16 SymbolCacheSupport 0x127705684 ModuleImporter.importObjcDependencyImport(:) + 692 17 SymbolCacheSupport 0x12774894c specialized collectDependencies #1 (:) in SymbolCacheSDKStorage.indexedModule(type:dependencyRetriever:) + 512 18 SymbolCacheSupport 0x127747a38 specialized SymbolCacheSDKStorage.indexedModule(type:dependencyRetriever:) + 1156 19 SymbolCacheSupport 0x12770236c ModuleImporter.import(:) + 96 20 SymbolCacheSupport 0x127705684 ModuleImporter.importObjcDependencyImport(:) + 692 21 SymbolCacheSupport 0x12774894c specialized collectDependencies #1 (:) in
1
0
315
Dec ’24
Unable to find a destination matching the provided destination specifier
I am attempting to test my app from the command line using fastlane but am running into issues with the build due to xcodebuild not being able to find the specified simulator. I have been attempting to debug by running the xcodebuild command manually and here is what I have been able to gather: Running xcodebuild -scheme MyAppName -destination "platform=iOS Simulator,OS=18.1,name=iPhone 16 Pro" errors with a message saying xcodebuild: error: Unable to find a destination matching the provided destination specifier: { platform:iOS Simulator, OS:18.1, name:iPhone 16 Pro } If I run xcodebuild -scheme MyAppName -showdestinations, I can see { platform:iOS Simulator, id:7F3E4A35-E5DB-4EF4-AFAD-156EC463FEA8, OS:18.1, name:iPhone 16 Pro } listed in the options. Specifying the destination using the id yields the same result. However, if I run xcodebuild -scheme MyAppName -destination "platform=iOS Simulator,OS=18.1,name=iPhone 16 Pro" test (note the extra test at the end) the tests run successfully. I have checked that my minimum deployment number is correct (iOS 16), ensured that my supported platforms is set to iOS, and followed every other suggestion I could find on this matter. What am I missing here?
2
1
645
Dec ’24
On-demand resources asset packs invalidated on app update
Hello, I have an issue using on-demand resources. It happens that on every update the asset packs are always reported to be not present, even if the resources tagged on every asset pack do not change. This is very annoying since we rarely change the on demand resources on the asset packs, but our users still have to redownload them each time. I have inconsistent behavior debugging on Xcode directly on a device, so I am only able to consistently reproduce the issue uploading two builds on TestFlight. I have prepared a test project that I have tested on TestFlight and always reproduce the issue: https://drive.google.com/file/d/1oEH_ZBFjGIDTCrxe7Lu8XsFErFurg6HS/view?usp=sharing STEPS TO REPRODUCE Archive the "TestODR iOS" target Upload it on TestFlight Download it on a test iOS device and launch it Tap on "Download" button to get the on-demand resouces (it starts the download of two on-demand packs) Wait the download until you see "packAvailable = 1" on both packs Bump both the build and version numbers of the target Archive the "TestODR iOS" with the versions bumped Upload the new archive on TestFlight When it becoums available on TestFlight tap on "Update" button and launch it after the update When the app is launched you will see "packAvailable = 0" for both packs. Expected behaviour: After the update we expect to see packAvailable = 1 since no asset have changed between the two versions. Thanks, Francesco
3
0
669
Dec ’24
For iOS is not a valid binary
I have a problem uploading to testflight. When I archived my app, it announced success, but when I went to the appstoreconnect website I didn't see any builds, while I waited a long time for it to be pushed up. And one more problem, when the upload notification is uploaded, after a while there is a notification that my app for ios is not a valid binary, I don't understand this problem. Can you please ask me how to solve it?
0
0
435
Dec ’24
What is all this console spew, and how to manage it?
Something (or a lot) is janky about apps built for "My Mac - designed for iPad." Aside from things just not working, the amount of garbage spewed to the console during debugging is unmanageable. I can't see my own trace statements amongst screens and screens of repetitive nonsense. I right-clicked on it and set it to filter out errors, but I'd like to get notified of legitimate errors. Anyone employing a clever filtering method I'm not aware of?
4
0
649
Dec ’24
Watch OS - Complications settings not showing anywhere.
I have a fully functioning IOS / Watch App working on hardware and software test. But, I cannot figure out how to get complications to show up: Xcode itself does not show complication choices in the target settings. Can't find a clear simple explanation of the various choices in the settings. Complication choices in the IOS iPhone app settings never appear Not at all sure how complications get assigned to 'groups' etc. ...been a roadblock for weeks...very confusing area. Not new to Xcode ( 10+ years experience). But the basic certificate, settings, info list combination seems always to be a massive hurdle to navigate.
1
0
403
Dec ’24
Third party frameworks are not found
Hi, Can someone please suggest a answer for my problem. I am developing an iOS app using Qt and I am trying to implement AdMob. I installed using below Pod file. # Uncomment the next line to define a global platform for your project # platform :ios, '9.0' target 'apptesting' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! # Pods for apptesting pod 'FirebaseAnalytics', '10.27.0' pod 'Google-Mobile-Ads-SDK', '11.5.0' end and these are installed correctly and testing.xcworkspace is created successfully. but when I run the build for xcworkspace in Xcode, it is showing below errors 'GoogleMobileAds/GoogleMobileAds.h' file not found 'FirebaseCore/FirebaseCore.h' file not found please see CMakeLists.txt file for your reference 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 please see AdMobManger.m below #import <UIKit/UIKit.h> #import <FirebaseCore/FirebaseCore.h> #import <GoogleMobileAds/GoogleMobileAds.h> // Static variables for banner ads static GADBannerView *bannerView = nil; void initializeAdMob() { // Initialize Firebase if ([FIRApp defaultApp] == nil) { [FIRApp configure]; } // Initialize Google Mobile Ads SDK [[GADMobileAds sharedInstance] startWithCompletionHandler:nil]; } void showBannerAd() { UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow; UIViewController *rootViewController = keyWindow.rootViewController; if (!bannerView) { // Create the banner ad view bannerView = [[GADBannerView alloc] initWithAdSize:GADAdSizeBanner]; bannerView.adUnitID = @"ca-app-pub-3940256099942544/2934735716"; // Test Ad Unit ID bannerView.rootViewController = rootViewController; // Position the banner at the bottom of the screen CGSize screenSize = [UIScreen mainScreen].bounds.size; bannerView.frame = CGRectMake( (screenSize.width - bannerView.frame.size.width) / 2, screenSize.height - bannerView.frame.size.height, bannerView.frame.size.width, bannerView.frame.size.height ); [rootViewController.view addSubview:bannerView]; } // Load the ad GADRequest *request = [GADRequest request]; [bannerView loadRequest:request]; } void hideBannerAd() { if (bannerView) { [bannerView removeFromSuperview]; bannerView = nil; } } I also implemented below change > In 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
0
454
Dec ’24