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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

dyld: Symbol not found ... certain MeshResource APIs on iOS 17.x
I submitted feedback as FB16463501 -- posting here for others to see, or maybe for Apple to share any help if there are workarounds, etc.: Targets below iOS 18.x fail to launch app due to dyld[xxxxx]: Symbol not found: errors when referencing: MeshResource.init(from:) async - https://developer.apple.com/documentation/realitykit/meshresource/init(from:)-b7hb i.e. dyld[61511]: Symbol not found: _$s10RealityKit12MeshResourceC0A10FoundationE4fromACSayAD0C10DescriptorVG_tYaKcfC MeshResource.replace(with:) async - https://developer.apple.com/documentation/realitykit/meshresource/replace(with:)-8uvri i.e. dyld[78830]: Symbol not found: _$s10RealityKit12MeshResourceC0A10FoundationE7replace4withyAcDE8ContentsV_tYaKF Targets tested that exhibit issue: (DYLD errors) Device: iOS 17.7.2, iPhone 14 Pro Max Simulator: iOS 17.5 (21F79), iPhone 15 System Information: macOS Version 15.3 (Build 24D60) Xcode 16.2 (23507) (Build 16C5032a) MRE -- include this code in your app: (no need to invoke, just reference) static func addOrUpdateEntityModel_MRE(_ entity: ModelEntity) async { let descriptor = MeshDescriptor(name: "MyDescriptor") do { if let modelComponent = entity.model { // update existing ModelComponent if let model = try? MeshResource.Model(id: "MyModelId", descriptors: [descriptor]) { var contents = MeshResource.Contents() contents.models = .init([model]) try await modelComponent.mesh.replace(with: contents) /// `dyld[78830]: Symbol not found: _$s10RealityKit12MeshResourceC0A10FoundationE7replace4withyAcDE8ContentsV_tYaKF` } } else { //create new ModelComponent /// Comment-out the 2 lines below == dyld error for above `MeshResource.replace(with:)` let meshRes = try await MeshResource(from: [descriptor]) /// `dyld[61511]: Symbol not found: _$s10RealityKit12MeshResourceC0A10FoundationE4fromACSayAD0C10DescriptorVG_tYaKcfC` entity.model = .init(mesh: meshRes, materials: [SimpleMaterial()]) } } catch { fatalError() } }
0
0
503
Feb ’25
xcrun devicectl not work as expected in Apple TV
What I want? I expect to use xcrun devicectl device process launch --device <uuid> <bundle-identifier> --payload-url <URL> to launch my app and pass the specified URL as I usually do in iPhone. What I do? Let's say the app A which I'm developing. I try to use UIApplication.open(:options:completionHandler:) in another app to open the app A with registered schema. And whether app A is cold launch or background resumption, app A can go foreground with receiving URL. If I use xcrun devicectl as above described, app A can still be opened. However, app A can't receive URL which I pass through --payload-url option. That's different from in iOS. BTW: I as well try YouTube with UIApplication.open and xcrun devicectl, the former way work, the latter way not work.
0
0
183
Mar ’25
Issue with Module Import and Archiving a Mixed Swift/C Library Using Swift Package Manager
Hello everyone, I’m encountering an issue when trying to build and archive my library BleeckerCodesLib using Swift Package Manager. My project is structured with two targets: CBleeckerLib: A C target that contains my image processing code (C source files and public headers). BleeckerCodesLib: A Swift target that depends on CBleeckerLib and performs an import CBleeckerLib. Below is the relevant portion of my Package.swift: // swift-tools-version:5.7 import PackageDescription let package = Package( name: "BleeckerCodesLib", platforms: [.iOS(.v16)], products: [ .library(name: "BleeckerCodesLib", targets: ["BleeckerCodesLib"]) ], targets: [ .target( name: "CBleeckerLib", publicHeadersPath: "include" ), .target( name: "BleeckerCodesLib", dependencies: ["CBleeckerLib"] ) ] ) Directory Structure My project directory looks like this: BleeckerCodesLib/ ├── BleeckerCodesLib.xcodeproj/ │ └── xcuserdata/ │ └── robertopitarch.xcuserdatad/ │ └── xcschemes/ │ └── xcschememanagement.plist ├── BleeckerCodesLib.h ├── Package.swift └── Sources/ ├── CBleeckerLib/ │ ├── bleecker-lib.c │ └── include/ │ ├── bleecker-lib.h │ └── CBleeckerLib.h └── BleeckerCodesLib/ ├── UIImage+Extensions.swift ├── ImageProcessingUtility.swift ├── APIManager.swift ├── BleeckerCodesLib.swift ├── CameraView.swift ├── RealTimeCameraView.swift └── BleeckerCameraWrapper.swift Code Example In my Swift code (for example, in BleeckerCodesLib.swift), I import the C module as follows: import SwiftUI import UIKit import CBleeckerLib // Import the C module public struct BleeckerCodes { public struct DetectedCode { public let code: String public let corners: [CGPoint] public init(code: String, corners: [CGPoint]) { self.code = code self.corners = corners } } // Initialization function public static func initializeLibrary() -> String { bleecker_init() // Call the C module function return "BleeckerCodesLibrary initialized!" } // ... other functions } The Problem When I try to compile or archive the project using commands such as: xcodebuild archive -project BleeckerCodesLib.xcodeproj -scheme BleeckerCodesLib -destination "generic/platform=iOS" -archivePath "archives/BleeckerCodesLib" I receive the error: "no such module 'CBleeckerLib'" Any assistance or step-by-step guidance on resolving this integration issue would be greatly appreciated. Thank you in advance!
0
0
241
Feb ’25
Xcode messes up the MacBook Screen Size
Hi everyone, I’ve been experiencing a persistent issue with my MacBook Pro (M2 Pro, macOS 15.2) when using Xcode (version 16.2). If Xcode is open and my Mac goes into sleep mode, the screen size changes upon waking. Specifically, I notice 3mm bezels appear on each side of the screen, making the display slightly smaller, and everything scales down to fit this reduced size. This issue happens multiple times a day and has been ongoing for over a year. It’s quite disruptive to my workflow. Here is a video to illustrate the problem: Has anyone encountered this before? If so, do you have any suggestions for fixing it or steps I can take to debug the issue? Thanks in advance for your help and support!
0
0
163
Jan ’25
Xcode 16.3 beta: Unable to specify package traits for testing
Swift 6.1 introduces package traits, which are great. But sometimes one might want to have a trait that is not enabled by default, and in such cases you will still want to be able to unit test them. Can we get an option, perhaps in the test plan configuration, that would allow us to specify traits that should be enabled when compiling for testing, even if those traits are not enabled by default? Bonus points if we could have multiple test plans that each build with a different set of traits, and running all the tests would cause the package to be built multiple times, so that all possible combinations of traits could be properly unit tested.
0
2
336
Feb ’25
Xcode completion binding not working in 16.2
I'm wondering why 'Select Previous Completion' and 'Select Next Completion' aren't working. I'm using Ctrl-K and Ctrl-J but only my arrow keys work to navigation the completion list. 'Show Completion List' works just fine with Ctrl-Esc. There are no conflicts with any Xcode bindings, and I've checked my system settings for keyboard shortcuts as well.. I've completely disabled copilot, etc.. Is there another setting I'm missing? Or, is this a known issue?
0
0
31
Apr ’25
Affiliate View Struct is probably hidden by Charts on iOS app
The problem is: As per screenshot below, one can only see the lineChart. I have another struct AffiliateView coded under this Chart: import SnapKit import Charts import DGCharts class AffiliateViewController: UIViewController { private lazy var chartView: LineChartView = { let chart = LineChartView() chart.noDataText = "No data available." chart.chartDescription.enabled = false chart.xAxis.labelPosition = .bottom chart.rightAxis.enabled = false chart.legend.enabled = true chart.backgroundColor = .lightGray // For debugging visibility return chart }() private lazy var containerView: UIView = { let view = UIView() view.backgroundColor = .white return view }() override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .white // Add container view and chart view to the main view view.addSubview(containerView) view.addSubview(chartView) // Add SwiftUI View inside the container view let affiliateView = AffiliateView() let hostingController = UIHostingController(rootView: affiliateView) addChild(hostingController) containerView.addSubview(hostingController.view) hostingController.view.frame = containerView.bounds hostingController.didMove(toParent: self) layout() setupChartData() } private func layout() { // Layout the container view (SwiftUI content) containerView.snp.makeConstraints { make in make.top.equalTo(view.safeAreaLayoutGuide.snp.top) make.left.right.equalToSuperview() make.height.equalTo(350) // Increase the height for the SwiftUI content } // Layout the chart view below the container view chartView.snp.makeConstraints { make in make.top.equalTo(containerView.snp.bottom).offset(20) // Space between chart and the affiliate content make.left.equalToSuperview().offset(20) make.right.equalToSuperview().offset(-20) make.height.equalTo(200) // Set a fixed height for the chart } } private func setupChartData() { let dataEntries = [ ChartDataEntry(x: 1, y: 10), ChartDataEntry(x: 2, y: 20), ChartDataEntry(x: 3, y: 15), ChartDataEntry(x: 4, y: 30), ChartDataEntry(x: 5, y: 25) ] let dataSet = LineChartDataSet(entries: dataEntries, label: "Clicks per Day") dataSet.colors = [.blue] dataSet.valueColors = [.black] dataSet.circleColors = [.red] dataSet.circleRadius = 4.0 let data = LineChartData(dataSet: dataSet) chartView.data = data chartView.notifyDataSetChanged() } } // SwiftUI View remains in the same file struct AffiliateView: View { @State private var customMessage: String = "" @State private var uniqueLink: String = "Your unique link will appear here." @State private var clickData: [Double] = [10, 20, 15, 30, 25] // Example data var body: some View { NavigationView { VStack(spacing: 20) { // TextField for custom message input TextField("Enter your custom message...", text: $customMessage) .textFieldStyle(RoundedBorderTextFieldStyle()) .padding(.horizontal) // Generate Link Button Button(action: generateLink) { Text("Generate Sign-Up Link") .font(.headline) .foregroundColor(.white) .frame(maxWidth: .infinity, maxHeight: 50) .background(Color.red) .cornerRadius(10) } .padding(.horizontal) // Generated Link Label Text(uniqueLink) .font(.body) .multilineTextAlignment(.center) .padding(.horizontal) // You can add a chart here if you want to show it in SwiftUI too /* LineChartView(data: clickData, title: "Clicks per Day", legend: "Daily Clicks") */ } .navigationTitle("Affiliate Marketing") .navigationBarTitleDisplayMode(.inline) } } private func generateLink() { let encodedMessage = customMessage.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? "" uniqueLink = "https://affiliate.example.com/referral?message=\(encodedMessage)" addClickData() } private func addClickData() { clickData.append(Double.random(in: 0...100)) } } As you see, the AffiliateView has been declared outside of Controller View class. The View content was visible before the lineChart was added into this code. Now the View content is not visible anymore. I have tried to increment/decrement values at make.height.equalTo() but to no avail. Could anyone kindly point me in the right direction?
0
0
305
Jan ’25
Undefined time_t in openssl
I'm having trouble compiling my project for the iOS 18.2 simulator. I'm getting the following error: `Missing '#include <sys/_types/_time_t.h>'; 'time_t' must be declared before it is used` The error points to to simulartor-iOS 18.2 > user/include/sys/_types/_time_t.h #ifndef _TIME_T #define _TIME_T #include <machine/types.h> /* __darwin_time_t */ typedef __darwin_time_t time_t; #endif /* _TIME_T */ This suggests that the time_t type should be defined, but the compiler isn't seeing it. I suspect there might be a problem with preprocessor definitions. Is there anything I set wrong? I am using OpenSSL.xcframework.
0
1
227
Jan ’25
Why can't Xcode find symbols in scope, but still compiles?
My swiftUI project has started to constantly display "Cannot find 'symbol' in scope" errors in code i haven't touched, and the project still compiles fine. Neither cleaning build folder or compiling fix the errors, but if I right click the symbol, select "jump to definition" it will find it without problem and then when I return to the original file the error will be cleared. What can I do to stop these from happening?
0
1
178
Feb ’25
How to exclude header files from 3rd party pods from getting the Apple Clang warning policies?
I have the 'warnings as errors' policy set to Yes for Apple Clang and Swift compiler. As far as I know, there is no way to make exceptions to the warning policies from Swift compiler (correct me if I am wrong), what about Clang warning policies, specifically when it comes to header files from 3rd party pods? They don't show up on the Compile Sources so I can't apply flags such as -Wno-error=deprecated to them. Adding #pragma GCC... to them won't help as a fresh pod install will wipe the #pragma statements out. Is there a way to exclude the header files from pods from getting the warning policies from Clang so I won't see errors from them when compiling Clang modules that's a part of the build process?
0
0
303
Feb ’25
App crashing on real iPhone only (working fine on simulator and Xcode preview)
Hi, I'm currently facing an issue where my React Native app crashes only on a real iPhone. On the simulator and in Xcode preview, the app runs fine. Previously, I had an issue with FlatList regarding props.getItem, which I solved by installing some missing Babel dependencies. After that, everything worked correctly in the simulator. But when I try to open the app on a real device, it shows the splash screen and crashes immediately. I've already done a full clean and reset, including: npx react-native start --reset-cache Deleted node_modules and Pods, reinstalled everything Cleaned build folder via Xcode Deleted DerivedData Restarted Metro bundler and simulator/device The issue only happens on the physical device. Here’s a portion of the crash log IDate/Time: 2025-04-14 19:11:28.6796 -0300 Launch Time: 2025-04-14 19:11:28.5292 -0300 OS Version: iPhone OS 18.3.2 (22D82) Release Type: User Baseband Version: 4.20.03 Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: SIGNAL 6 Abort trap: 6 Terminating Process: JazminChebar [1973] Triggered by Thread: 0 Last Exception Backtrace: 0 CoreFoundation 0x19a0865fc __exceptionPreprocess + 164 (NSException.m:249) 1 libobjc.A.dylib 0x197601244 objc_exception_throw + 88 (objc-exception.mm:356) 2 JazminChebar 0x1009b2c04 RCTFatal + 568 (RCTAssert.m:147) 3 JazminChebar 0x1009c81f8 __28-[RCTCxxBridge handleError:]_block_invoke + 532 (RCTCxxBridge.mm:1178) 4 libdispatch.dylib 0x1a1e19248 _dispatch_call_block_and_release + 32 (init.c:1549) 5 libdispatch.dylib 0x1a1e1afa8 _dispatch_client_callout + 20 (object.m:576) 6 libdispatch.dylib 0x1a1e29a34 _dispatch_main_queue_drain + 984 (queue.c:8093) 7 libdispatch.dylib 0x1a1e2964c _dispatch_main_queue_callback_4CF + 44 (queue.c:8253) 8 CoreFoundation 0x19a0d2bcc CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 16 (CFRunLoop.c:1793) 9 CoreFoundation 0x19a0cf1c0 __CFRunLoopRun + 1996 (CFRunLoop.c:3163) 10 CoreFoundation 0x19a121284 CFRunLoopRunSpecific + 588 (CFRunLoop.c:3434) 11 GraphicsServices 0x1e73914c0 GSEventRunModal + 164 (GSEvent.c:2196) 12 UIKitCore 0x19cc6a674 -[UIApplication _run] + 816 (UIApplication.m:3846) 13 UIKitCore 0x19c890e88 UIApplicationMain + 340 (UIApplication.m:5503) 14 JazminChebar 0x100178708 main + 80 (main.m:7) 15 dyld 0x1c037dde8 start + 2724 (dyldMain.cpp:1338)
0
0
63
Apr ’25
How to Handle Identically Named Files in Different Folders in Xcode 16
Hello everyone =) I'm working at the moment on a project in Xcode 16 where I need to have multiple files with the exact same name, stored in different folders (for example, separate quest data files). When I compile, Xcode seems to treat these identically named files as duplicates, causing build errors. How can I properly organize (or configure) Xcode so that it recognizes these files as distinct? Any advice or best practices would be greatly appreciated. Thank you! ;)
0
0
244
Dec ’24
watchOS-Questions about HealthKit privileges
The WatchOS developer is not allowed to obtain healthKit permission status. The result is always unauthorized (either by clicking the dot/cross in the upper left corner or by turning on all Health, on some, off all). WatchOS 开发获取 healthKit 的权限状态authorizationStatus不准。结果始终都是未授权(无论是点击左上角的点叉号还是开启全部健康项开关,开启部分,关闭所有),怎么处理?
0
0
56
Apr ’25
Active Compilation Conditions in Packages
The flags like #if DEBUG ... endif are dependent on the Active Compilation Conditions. So if they say DEBUG the enclosed code block will be executed, otherwise not. Now I have the phenomenon that a #DEBUG block in a Package does not evaluate these conditions. It rather depends on the name of the configuration used to build. So if I build my app with Active Compilation Condition set to DEBUG, but the configuration name is something like App-Release, the DEBUG block in my Package is not added/executed. The ones which are directly in the project are added. Vice versa if the Compilation Condition say RELEASE but the configuration is called App-Debug the blocks in the Package are added to the compilation, but the ones in the project itself are not It suffices that the config name contains the word Debug for this to happen. E.g. the configuration App-Release-Debug (I know that this would be stupid, but it is for demonstrating purposes) will cause the Packages to include the DEBUG blocks. This happens no matter what you set in the Build Settings of the project and/or target. The Packages are added via GitHub/GitLab Source Control with SPM. Any ideas why this behaves like it does? It doesn't seem like it should...
0
1
97
Mar ’25
Linking static libraries openssl to Xcode 15.2 project fails due to link errors
Hello, I used to add openssl static libraries (libssl.a, libcrypto.a) that, I created on Mac, and add them after to my C++ project within XCode. With Xcode 14.2 (and before) all works fine. Switching to Xcode 15.2, tons of link errors rise (ld: Undefined symbols). I tried _ld_classic to force use 'old' linker but no success. Rebuild the static libraries with multiple config param or upgrade to recent openssl library does not help. Any clues what went wrong when linking static libraries with Xcode 15.2 project? Thx.
0
0
173
Jan ’25
Apple developer
in xcode i have select the developer team. but show some error that is here, "Communication with Apple failed Your team has no devices from which to generate a provisioning profile. Connect a device to use or manually add device IDs in Certificates, Identifiers & Profiles. https://developer.apple.com/account/" and show this error also "No profiles for 'com.kuntaldoshi.homeautomation' were found Xcode couldn't find any iOS App Development provisioning profiles matching 'com.kuntaldoshi.homeautomation'."
0
0
351
Feb ’25