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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

Issue with GitHub Copilot in Xcode 16 on macOS 14.6 with Netskope Enabled
Hello everyone, I am using Xcode 16 on macOS 14.6 and have integrated GitHub Copilot for Xcode. However, GitHub Copilot stops functioning when Netskope is enabled on my Mac. I have the necessary SSL certificate in my Mac’s Keychain and have trusted it. When I check, GitHub Copilot successfully connects to the server. However, I can’t find an option to set the certificate in Xcode. Since Netskope is required by my organization, I cannot disable it. Has anyone encountered this issue or know how to resolve it? Thank you in advance for your help!
0
0
309
Jan ’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
307
Jan ’25
MapKit not working in Swift Playgrounds
This is the complete Playground code: import MapKit import SwiftUI import PlaygroundSupport struct AddressSearchView: View { @State private var region = MKCoordinateRegion( center: CLLocationCoordinate2D(latitude: 37.7749, longitude: -122.4194), span: MKCoordinateSpan(latitudeDelta: 0.01, longitudeDelta: 0.01) ) var body: some View { VStack { Map(position: .constant(MapCameraPosition.region(region))) { } .frame(height: 300) } } } struct AddressSearchView_Previews: PreviewProvider { static var previews: some View { AddressSearchView() } } PlaygroundPage.current.setLiveView(AddressSearchView()) When I try to run this I get this in the debug console: error: Couldn't look up symbols: protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI Hint: The expression tried to call a function that is not present in the target, perhaps because it was optimized out by the compiler. the preview never shows up. If I use other SwiftUI components and not the map it works fine. What is happening? Playground target is Swift 6 macOS (iOS does the same). Xcode 16.2
0
0
232
Mar ’25
CoreBluetooth Scan not working when OS upgraded to 18.3.1
Hi, I currently have an app that connect to an arduno via CoreBluetooth. However, the app no longer discovers the arduino when the operating system was upgraded to iOS 18.3.1, however on iOS version 17.6.1 the ardiuno was discoverable I was able to test this theory on two different phones each with different iOS versions. Why are my peripherals no longer being discovered with this update? and what is the solution?
0
0
211
Mar ’25
Swift, kevent, and wth?!?!?
I have this code: var eventIn = kevent(ident: UInt(self.socket), filter: Int16(EVFILT_WRITE), flags: UInt16((EV_ADD | EV_ENABLE)), fflags: 0, data: 0, udata: nil ) I looked at it and thought why do I have those extra parentheses? So I changed it to var eventIn = kevent(ident: UInt(self.socket), filter: Int16(EVFILT_WRITE), flags: UInt16(EV_ADD | EV_ENABLE), // changed line! fflags: 0, data: 0, udata: nil ) and then kevent gave me EBADF. Does this make sense to anyone?
0
0
230
Feb ’25
Error Missing required module 'RxCocoaRuntime' in xcframeworks
Hi. I have a xcframework that has a dependency on 'RxSwift' and 'RxCocoa'. I deployed it using SPM by embedding it in a Swift Package. However when I import swift package into another project, I keep getting the following error: "Missing required module 'RxCocoaRuntime" How can I fix this? Below are the steps to reproduce the error. Steps Create Xcode proejct, make a dependency on 'RxSwift' and 'RxCocoa' (no matter doing it through tuist or cocoapods) Create XCFramework from that proejct. (I used commands below) xcodebuild archive \ -workspace SimpleFramework.xcworkspace \ -scheme "SimpleFramework" \ -destination "generic/platform=iOS" \ -archivePath "./SimpleFramework-iphoneos.xcarchive" \ -sdk iphoneos \ SKIP_INSTALL=NO \ BUILD_LIBRARY_FOR_DISTRIBUTION=YES xcodebuild archive \ -workspace SimpleFramework.xcworkspace \ -scheme "SimpleFramework" \ -archivePath "./SimpleFramework-iphonesimulator.xcarchive" \ -sdk "iphonesimulator" \ SKIP_INSTALL=NO \ BUILD_LIBRARY_FOR_DISTRIBUTION=YES xcodebuild -create-xcframework \ -framework "./SimpleFramework-iphoneos.xcarchive/Products/Library/Frameworks/SimpleFramework.framework" \ -framework "./SimpleFramework-iphonesimulator.xcarchive/Products/Library/Frameworks/SimpleFramework.framework" \ -output "./SimpleFramework.xcframework" Embed in Swift Package, and deploy. // swift-tools-version: 6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "SimplePackage", platforms: [.iOS(.v16)], products: [ .library( name: "SimplePackage", targets: ["SimplePackage"]), ], dependencies: [ .package(url: "https://github.com/ReactiveX/RxSwift", from: "6.8.0") ], targets: [ .binaryTarget( name: "SimpleFramework", path: "Sources/SimpleFramework.xcframework" ), .target( name: "SimplePackage", dependencies: [ "SimpleFramework", "RxSwift", .product(name: "RxCocoa", package: "RxSwift") ] ) ] ) Download Swift Package in another project and import module. I resolved this by removing dependencies from the Swift Package, downloading package in another project, and fetching dependencies by cocoapods. Thist works, but I don't want to use another dependency manager while using SPM. Development Environment CPU : Apple M4 Max MacOS : Sequoia 15.3 Xcode : 16.2
0
0
247
Mar ’25
Provisioning profile "iOS Team Provisioning Profile: com.xfinity.mobile.spamfilter" doesn't include the currently selected device . But there is no selected/built for device
I'm attempting make to make a distribution build of an app. In the Xcode target the supported destinations has only iPhone and build active architectures only is set to NO. I created an archive, then selected Distribute App/ Debugging, but then got this error: Provisioning profile "iOS Team Provisioning Profile: com.abc.def" doesn't include the currently selected device "DT-iPad-XXXX" (identifier YYYY-YYYYYY). I've no idea what this device is, it's nothing to do with me, somebody must have added it to the provisioning profile. But that should be beside the point shouldn't it? Because this device has never ever been connected to my Mac/Xcode and so can't be "the currently selected device". So I tried again. I changed build active architectures to YES and connected an iPhone to the Mac/Xcode and created an archive again. But it was the exact same error. What's going on, why is Xcode saying this iPad is the currently selected device when attempting to make a distribution?
0
0
604
Jan ’25
Build input file cannot be found
Hi! When I run my project on a real device (iPhone 15 Pro), I encounter the following error: Build input file cannot be found: '/Users/Interexy/Library/Developer/Xcode/DerivedData/SinglePhotoBook-geecnphrjebsisdmhcyzlsefvphm/Build/Products/Debug-iphoneos/SinglePhotoBook.app/SinglePhotoBook'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? How can I solve this? I've already reinstalled Pods and cleaned DerivedData a million times, but the issue persists. Xcode: Version 15.4
0
0
257
Mar ’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
Xcode 16 is running on an iPhone 7 with iOS 12.1.3. The application fails to open normally and crashes immediately upon startup.
I am currently using Xcode 16 (16A242d) and testing on an iPhone 7 running iOS 12.1.3. However, when I try to launch the app on the device, it crashes immediately. Below are the crash logs from the iPhone 7: 错误 11:54:55.731858+0800 kernel Sandbox: assertiond(62) System Policy: deny(1) file-read-metadata /private/var/mobile/Library/DuetExpertCenter/caches/ATXCacheFile-_ATXAppPredictor-TotalScore 错误 11:54:55.731897+0800 kernel Sandbox: assertiond(62) System Policy: deny(1) file-read-metadata /private/var/mobile/Library/DuetExpertCenter/caches 错误 11:54:55.754498+0800 kernel Sandbox: duetexpertd(132) deny(1) mach-lookup com.apple.proactive.ActionPrediction.predictions 错误 11:54:55.756102+0800 duetexpertd Unable to remove recent engagement cache file. Error: Error Domain=NSCocoaErrorDomain Code=4 UserInfo={NSFilePath=, NSUserStringVariant=, NSUnderlyingError=0x100db60a0 {Error Domain=NSPOSIXErrorDomain Code=2}} 错误 11:54:56.571640+0800 symptomsd Attempt to add an app with insufficient id, info { BKSApplicationStateAppIsFrontmost = 1; BKSApplicationStateExtensionKey = 0; SBApplicationStateDisplayIDKey = "com.igetcool.app"; SBApplicationStateKey = 8; SBApplicationStateProcessIDKey = 696; SBApplicationStateRunningReasonsKey = ( { SBApplicationStateRunningReasonAssertionIdentifierKey = UIApplicationLaunch; SBApplicationStateRunningReasonAssertionReasonKey = 10000; } ); SBMostElevatedStateForProcessID = 8; } 错误 11:54:56.829372+0800 assertiond [IGCProject:696] SyscallError: setpriority(PRIO_DARWIN_ROLE, 696, 3): No such process 错误 11:54:56.944833+0800 dasd Activity not tracked as being started, ignoring it 错误 11:55:06.153790+0800 symptomsd Attempt to add an app with insufficient id, info { BKSApplicationStateAppIsFrontmost = 1; BKSApplicationStateExtensionKey = 0; SBApplicationStateDisplayIDKey = "com.igetcool.app"; SBApplicationStateKey = 8; SBApplicationStateProcessIDKey = 697; SBMostElevatedStateForProcessID = 8; } 错误 11:55:06.430433+0800 assertiond [IGCProject:697] SyscallError: setpriority(PRIO_DARWIN_ROLE, 697, 3): No such process 错误 11:55:13.158889+0800 symptomsd Attempt to add an app with insufficient id, info { BKSApplicationStateAppIsFrontmost = 1; BKSApplicationStateExtensionKey = 0; SBApplicationStateDisplayIDKey = "com.igetcool.app"; SBApplicationStateKey = 8; SBApplicationStateProcessIDKey = 699; SBMostElevatedStateForProcessID = 8; } 错误 11:55:13.416290+0800 assertiond [IGCProject:699] SyscallError: setpriority(PRIO_DARWIN_ROLE, 699, 3): No such process I am trying to understand what is causing this issue. Even after archiving and installing the app, it still crashes. According to the official documentation, Xcode 16 is supposed to support iOS 12, but this issue persists. I would like to know the possible reasons for this behavior.
0
0
320
Mar ’25
Which extension use
Hi, I want to block incoming calls using my backend server, like the unwantend sms using message filter extension. I saw that Call Directory Extension can block numbers, but you need update the list, is not in real time. I was reading the Live Caller ID Look up extension documentation, and it seems that with this extension is possible send the number to backend and retrieve a value to know if the call should be block or not. Am I right? Or is not possible this feature with this extension? Thanks!
0
1
278
Mar ’25
Bonjour Capabilities
I'm a noobie but doing a tutorial where it requires me to add these capabilities to my project. Access Wi-Fi Information Network Extentions Bonjour Services I have the Access Wi-Fi and Network Extentions installed but I could not find Bonjour Services Any help would be much appreciated! Thanks
0
0
145
Jan ’25
XCode 16.2 forgets my git credentials constantly
Like the title says, I'll commit some changes no problem with my Git name and email displayed properly, then work for a while longer and when use the integrate menu to stage and commit I find the git name/email are empty. My credentials are properly entered in settings. The only fix i've found is quitting and restarting. Any less frustrating option?
0
0
167
Feb ’25
XCode 16.2 - error: unable to open dependencies file
Hello, I am encountering "unable to open dependencies file" error in XCode that started after updating to Xcode version 16.2 and macOS version 15.2. The error message I receive is as follows: error: unable to open dependencies file (/Users/user/Library/Developer/Xcode/DerivedData/MyProject-cwpcmnebzjpgkzcuoauxlaeiqrsg/Build/Intermediates.noindex/MyProject.build/Debug-iphoneos/MyProject.build/Objects-normal/arm64/MyProject-master.d) (in target 'MyProject' from project 'MyProject') This problem didn’t occur with XCode 16.1; the project was building successfully before the update. Now, even reverting to XCode 16.1 doesn’t resolve the issue anymore. Here’s what I’ve tried so far without success: Switched the compilation mode to “Whole Module” Cleaned the build folder Cleared Derived Data Thank you in advance for any suggestions!
0
4
912
Dec ’24