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

Xcode Documentation

Post

Replies

Boosts

Views

Activity

WidgetKit Simulator with Intent Configurations
Xcode 16.2 are unavailable to develop widget with dynamic options, no matter SiriIntent or AppIntent that I try to use. I have try to start a complete new project, then add widget with app intent checkbox check, with zero code changed then i press command run and WidgetKit Simulator present CHSErrorDomain error 1103 always, if i try to add widget directly from desktop, dynamic options are available to select but widgets doesn't seem like load successfully, it is stuck same in the WidgetKit Simulator. I also try to start a new project in my other MacBook but no luck, this error are presenting all the time, I'm totally stuck here, does anybody having this issue?
2
0
264
3w
Xcode unable to find custom info.plist file
Hello, New to swift ui and xcode. I am building a mobil app that will need bluetooth capabilities. When I make my custom info.plist file and set "Generate info.plist file" to No, it states it cannot find my file. Then when I set that to "Yes" it gives me an error stating that there are multiple versions of the file. In my editor I cant seem to set a path to it either. Any help would be greatly appreciated. this is the result when the the section is set to No Cannot code sign because the target does not have an Info.plist file and one is not being generated automatically. Apply an Info.plist file to the target using the INFOPLIST_FILE build setting or generate one automatically by setting the GENERATE_INFOPLIST_FILE build setting to YES (recommended). this is when its set to yes: Multiple commands produce '/Users/thatcherdeyoework/Library/Developer/Xcode/DerivedData/SwiftUI-weather-etzagqgbgkjotzenbomwvkhjfhzt/Build/Products/Debug-iphoneos/SwiftUI-weather.app/Info.plist'
0
0
147
3w
Getting a datagram too large error while writing back to NEAppProxyUDPFlow
I am trying to setup an extension using DNSProxyProvider that intercepts the DNS traffic on UDP and inserts our custom device identifier and send it to our custom DNS Server which gives us the response which I forward to the requesting client. I have been able to append the identifier with the domain name when sending out request to our custom DNS and I am getting the response back just fine but when I try to write the response to the udpflow I get this error in Console Logs. Error Domain=NEAppProxyFlowErrorDomain Code=9 "The datagram was too large" UserInfo={NSLocalizedDescription=The datagram was too large} Here is what I have tried so far. Truncating the datagram size to less than 10 bytes. Sending in dummy Data object while trying to write to the flow. Double checking the Signing and Capabilities, for Targets, the App and Network Extension. Attached below is code from my NEDNSProxyProvider. The DNS request is process in the handleNewFlow function which calls processUDPFlow override func handleNewFlow(_ flow: NEAppProxyFlow) -> Bool { if flow is NEAppProxyTCPFlow { NSLog("BDDNSProxyProvider : Is TCP Flow...") } else if let udpFlow = flow as? NEAppProxyUDPFlow { NSLog("BDDNSProxyProvider: handleNewFlow : \(udpFlow)") processUDPFlow(udpFlow) // < -- } return true } In the code below I concatenate domain name in the request with deviceId and send it to our server. Also have the Logs lines in, please ignore them. // Read incoming DNS packets from the client self.udpAppProxyFlow = udpFlow udpFlow.readDatagrams { datagrams, error in if let error = error { NSLog("Error reading datagrams: \(error.localizedDescription)") return } guard let datagrams = datagrams else { NSLog("No datagrams received.") return } // Forward each DNS packet to the custom DNS server for (index, packet) in datagrams.enumerated() { let dnsMessage = self.parseDNSMessage(from: packet.0) NSLog("tDatagram Header: \(dnsMessage.header)") for question in dnsMessage.questions { NSLog("tDatagram Question: \(question.name), Type: \(question.type), Class: \(question.klass)") } for answer in dnsMessage.answers { NSLog("tDatagram Answer: \(answer.name), Type: \(answer.type), Data: \(answer.data)") } let oldDomain = self.extractDomainName(from: packet.0)! let packetWithNewDomain = self.replaceDomainName(in: packet.0, with: "827-\(oldDomain)") // func to append device ID NSLog("Packet's new domain \(self.extractDomainName(from: packetWithNewDomain ?? packet.0) ?? "Found nil")") self.sendToCustomDNSServer(packetWithNewDomain!) { responseDatagram in guard let responseDatagram = responseDatagram else { NSLog("Failed to get a response from the custom DNS server") return } let tDatagram = (responseDatagram, packet.1) udpFlow.writeDatagrams([tDatagram]) { error in if let error = error { NSLog("Failed to write DNS response back to client: \(error)") } else { NSLog("Successfully wrote DNS response back to client.") } } } } // Continue Reading Datagrams - DO NOT REMOVE! self.processUDPFlow(udpFlow) } } Following is the function I use to replace domainName // Ensure the datagram is at least the size of the DNS header guard datagram.count > 12 else { NSLog("Error : Invalid datagram: Too small to contain a DNS header") return nil } NSLog("BDLine 193") // Start reading after the header (12 bytes) var offset = 12 // Parse the original domain name while offset < datagram.count { let length = Int(datagram[offset]) // Get the length of the next label offset += 1 // Check for the null terminator (end of domain name) if length == 0 { // Domain name ends here break } // Validate that the length is within bounds guard offset + length <= datagram.count else { NSLog("Error : Invalid datagram: Domain name length exceeds packet size") return nil } // Skip over this label offset += length } Everything is falling into place other than this last Error I get when I try to write back to flow. What am I missing here and how can I resolve this issue? Any help would be appreciated. Thanks
1
0
189
3w
Why does Xcode's Minimum Deployments only let you select N.6?
I want to set the minimum deployment to 16.0, however Xcode (16.2) won't let me select that. In the drop down box it shows 18,17,16,15, however if any of these is selected it sets them as 18.6, 17.6, 16.6 or 15.6 (see image) If an attempt is made to edit the value manually, to 16.0, then after change it, Xcode just deletes that value and sets it to nothing. What's going on here? Why is Xcode only allowing the version other than be something.6 and why will it not let you manually edit it?
1
0
167
3w
Prevent Xcode from injecting UIRequiredDeviceCapabilities
Xcode 16.2 suddenly injects the UIRequiredDeviceCapabilities key into our app's Info.plist. This results in a rejection from App Store Connect because of this key: TMS-90109: This bundle is invalid - The key UIRequiredDeviceCapabilities in the Info.plist may not contain values that would prevent this application from running on devices that were supported by previous versions. Refer to QA1623 for additional information: https://developer.apple.com/library/ios/#qa/qa1623/_index.html The setting INFOPLIST_KEY_UIRequiredDeviceCapabilities is empty in our project, yet Xcode still injects: <key>UIRequiredDeviceCapabilities</key> <array> <string>arm64</string> </array> How can we prevent that? Or is there a way to strip it out during the build process? The Info.plist seems to get generated during an invisible build step, is there a way to make this explicit?
3
1
213
3w
Unable to use XCode Auto-sign for a project with network + system extension
Hi, We are developing software that configures a network extension via a system extension on MacOS. The host application (run as service) enables network extension and system extension capabilities. It registers the network extension. The network extension has network extension capabilities and configures an app-group to be bundled into the service. What we have built is already working, i.e. we build, sign, notarize and ship the code (it's already running on hundreds of SIP enabled customer devices in production). But, we are currently falling back to manual profile management (i.e. download and import the profile) so that Xcode accepts the entitlements suffixed with -systemextention. Recently we are testing deployment on iOS devices. For iOS profiles we cannot overcome the issues with setting the profile manually, XCode complains about mismatching networkextension entitlements even when manually importing the profile. So I thought I get to the bottom of why automated signing is not working and hopefully overcome the issues with iOS. Upon configuring automatic signing we ran into the following problem: For a network extension that is installed via a system extension the network extension capabilities are expected to be defined with a -systemextension suffix, i.e.: <key>com.apple.developer.system-extension.install</key> <true/> <key>com.apple.developer.networking.networkextension</key> <array> <string>packet-tunnel-provider-systemextension</string> <string>app-proxy-provider-systemextension</string> <string>content-filter-provider-systemextension</string> <string>dns-proxy-systemextension</string> <string>dns-settings</string> <string>relay</string> When using automated signing the profile in our development account reflects these settings, i.e. the profile is correctly generated with the values above. However, XCode complains that the network extension capabilities don't match. I went as far as to configuring a new application-ID so that XCode would generate a new profile in the development account. I then downloaded and decoded the generated profile. The capabilities of the development portal profile were created as expected (as above), but somehow, the locally generated profile that is generated by XCode auto-sign expects: <key>com.apple.developer.system-extension.install</key> <true/> <key>com.apple.developer.networking.networkextension</key> <array> <string>app-proxy-provider</string> <string>content-filter-provider</string> <string>packet-tunnel-provider</string> <string>dns-proxy</string> <string>dns-settings</string> <string>relay</string> What XCode auto-sign expects is not reflected in the development account profile (!). I tried to overcome this by changing the entitlements of the project to omit the -systemextension suffix. XCode auto-sign seemingly works then, but once the application is actually signed by CodeSign the signing fails because the capabilities don't match with the development account profile. I tried profile re-generation by clearing Library/Developer/Xcode/UserData/Provisioning Profiles, but it always results in the same problem - either XCode is happy and the code signing fails when building, or the other way round. Bottom Line: I think that somehow XCode evaluates the profile validity differently from CodeSign; somehow when using automatic signing XCode does not take the network extension + system extension into account, but only expects the capabilities of the network extension. If anybody know how to overcome this problem please help :)
1
0
181
3w
Persistent "Framework 'Flutter' Not Found" Error When Building iOS Simulator
I'm currently facing a recurring issue while attempting to build my Flutter app for the iOS simulator. The build process fails with the following error Error (Xcode): Framework 'Flutter' not found Error (Xcode): Linker command failed with exit code 1 Steps I've Taken: Recreated the ios/ folder and cleared derived data: Used flutter clean to clean the project. Reinstalled CocoaPods with pod deintegrate followed by pod install. Verified Configuration: Checked AppDelegate and framework paths within Xcode. Set the deployment target to 14.0 in the Podfile. Additional Actions: Performed flutter clean again, followed by removal of Pods, .symlinks, and Flutter.framework under ios/. Updated CocoaPods, ensured all dependencies in pubspec.yaml are current. Added FirebaseCore initialization in AppDelegate.swift to resolve previous Firebase integration issues. Despite these efforts, the "Framework 'Flutter' not found" error persists. Here's the relevant part of my AppDelegate.swift and Podfile: swift import Flutter import UIKit @main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } } ruby platform :ios, '14.0' CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' project 'Runner', { 'Debug' => :debug, 'Profile' => :release, 'Release' => :release, } def flutter_root generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), FILE) unless File.exist?(generated_xcode_build_settings_path) raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" end File.foreach(generated_xcode_build_settings_path) do |line| matches = line.match(/FLUTTER_ROOT=(.*)/) return matches[1].strip if matches end raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" end require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) flutter_ios_podfile_setup target 'Runner' do use_frameworks! use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(FILE)) target 'RunnerTests' do inherit! :search_paths end end post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| xcconfig_path = config.base_configuration_reference.real_path xcconfig = File.read(xcconfig_path) xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR") end end end Error Log from Flutter Run: [ +278 ms] Failed to build iOS app [ +42 ms] Error (Xcode): Framework 'Flutter' not found [ +8 ms] Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation) [ +7 ms] Could not build the application for the simulator. [ +1 ms] Error launching application on iPhone 16 Pro Max. [ +6 ms] "flutter run" took 88,663ms. [ +164 ms] #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3) #1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:860:9) #2 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1450:27) #3 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19) #4 CommandRunner.runCommand (package:args/command_runner.dart:212:13) #5 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:421:9) #6 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19) #7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:364:5) #8 run.. (package:flutter_tools/runner.dart:131:9) #9 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19) #10 main (package:flutter_tools/executable.dart:94:3) . Environment: Flutter: Version 3.27.3, Channel stable Xcode: Version 16.2, Build 16C5032a CocoaPods: Version 1.16.2 macOS: Version 15.2 (24C101) Additional Context: Initially, the issue was resolved by the sequence of cleanup and reinstalls listed above, but it re-emerged after integrating Firebase authentication. After adding FirebaseCore to AppDelegate.swift, the Firebase issue was resolved, but the framework error returned. I'm seeking guidance to resolve this issue permanently. Any insights or suggestions would be greatly appreciated!
1
0
326
3w
Fetch Changes not working Xcode 16.2
I have cloned a private repo from GitHub and for the most part it seems to be working fine. e.g. commit, push and pull are working. However, Fetch Changes doesn't seem to work at all. It pops up a brief message as if it is working, but the status of my local branch under the Source Control Navigator -> Repositories does not get updated. Even after a push, the status still tells me I am ahead on the local branch. If I add a new file on the GitHub website, Fetch Changes will not see it and the repository status remains unchanged. All of these changes are immediately visible in 'Fork' (3rd party Git GUI). If I restart Xcode the status is updated correctly, but it does not keep up with further changes. Anything I can do other than avoid using Xcode for GitHub tasks? Update: This might just be a problem with the Source Control Navigator views not updating. I just found that if I change branch, the "Repositories" section will not reflect the branch change until I exit and re-enter that view. e.g. click on "Changes" and back into "Repositores" to see the update. That workaround does not impact the out of date repo status though (how many commits am I ahead or behind). Seems very buggy...
0
0
119
3w
How to build an iOS app using the command line on macOS Sonoma?
Hello, Now we support Apple applications and we are building applications on Mac laptops with regular updates. Our goal is to build an iOS app entirely through the command line using xcodebuild and other tools from Xcode Command Line Tools on a server with _macOS Sonoma (14.6.1) without a graphical user interface (only the command line)!!! We need to build and regularly update iOS applications on clients and our accounts and we are looking for a solution to fully automate the login process for these accounts. Our goal is to automate these processes on a server without involving a customer. Here’s what I need help with building and signing the app: What are the proper commands to build and sign the app using xcodebuild and put this application in Apple Store? Server has: xcode-select -version xcode-select version 2408. xcodebuild -version Xcode 16.1 Build version 16B40. In the first step, the certificates have been added to the keychain. We have two keychains. We can check it by running the command: security list-keychains: ` "/Users/ec2-user/Library/Keychains/login.keychain-db" "/Library/Keychains/System.keychain".` All certificates are kept in login.keychain-db. We can check it: security find-identity -p codesigning -v Answer is: `'Some hash "Apple Distribution: Name. (TEAM ID)"'.` Profision file is kept in /Users/ec2-user/Library/MobileDevice/Provisioning\ Profiles/. In the first step, we have added a cordova platform with iOS 11 version. Command is: cordova platform add ios. We tried to create a sign archive with automation but we couldn't do it because we got an error. Our command is xcodebuild \ -workspace "path/to/Packet-name Test.xcworkspace" \ -scheme "Packet-name Test" \ -sdk iphoneos \ -configuration Release \ -archivePath "./Packet-name Test.xcarchive" \ CODE_SIGN_STYLE=Automatic \ DEVELOPMENT_TEAM=XXXXXXXXXX \ -allowProvisioningUpdates \ archive We get errors: /Users/ec2-user/buildApps/MyNewApplication/packet-name.test/platforms/ios/Packet-name Test.xcodeproj: error: No Accounts: Add a new account in Accounts settings. (in target 'Packet-name Test' from project 'Packet-name Test') /Users/ec2-user/buildApps/MyNewApplication/packet-name.test/platforms/ios/Packet-name Test.xcodeproj: error: No profiles for 'packet-name.test' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'packet-name.test'. (in target 'Packet-name Test' from project 'Packet-name Test') We've read about this error so the decision is to create one-time passwords for this. Certainly last error is about a problem with login, but how we can fix it we don't know because we will be using different accounts for different applications. As a result, we have to use one-time passwords for different accounts. We would appreciate detailed instructions, example commands, and references to documentation that might address this workflow.
1
0
128
3w
TipUIPopoverViewController can be referenced below iOS 17 without a compiler error and it shouldn't
We have found a runtime crash using TipUIPopoverViewController because Xcode didn't warn about its usage when using a deployment target of iOS 16, without a proper #if available verification. In Xcode Version 16.2 (16C5032a), using swift code, TipUIPopoverViewController can be used without if #available(iOS 17, *) without even trigger a warning or compiler error. This is the snippet we're using in a UIViewController, and it compiles without a warning. @objc private func myMethod() { if presentedViewController is TipUIPopoverViewController { // do something } } Of course this triggers a runtime error, specifically, a EXC_BAD_ACCESS. I was expecting that the same way Xcode warns us when we're using Tips and Tips.Status with iOS 16, this would also trigger a compilation error.
2
0
164
3w
App will not archive a Catalyst Version
I have an iOS app which I'm trying to ship to the Mac App Store. The app was created for iOS 7, but has been kept up to date. I mention it because it has an old project file. I'm able to build and run the app on my Silicon Mac fine. However, when I archive with target "My Mac (Designed for iPad)", I get an archive of type "iOS App Archive". Here's what I've checked: Target is set to “My Mac (Designed for iPad)” “SUPPORTS_MACCATALYST” is set to “YES” on the main target and the extensions “MACOSX_DEPLOYMENT_TARGET” set to “14.6” on the main target and the extensions “Supported Platforms” is set to “iOS” except for Watch targets and targets which also run on watchOS. If I filter the build logs for "Catalyst" there are no results. If I filter them for "Mac" there are no relevant results. Clean build folder Delete derived data Restart Xcode Xcode Version 16.2 (16C5032a) macOS Version 15.2 Other notes: The app has a widget extension and an intents extension and two custom frameworks When I try and archive for Mac using Xcode Cloud, it runs for 90 minutes and then fails. I suspect it’s related to this issue but I’m not sure. I’ve had issues like this solved with DTS before, but that isn’t allowed any more. Any help would be greatly appreciated.
3
0
186
3w
Can build my app but not Archive
Apologies that this is probably a simple problem. I've started from a sample code provided by Apple and changed it quite significantly. However, I'm not able to Archive the app. The original visionOS sample code has the same issue, so hopefully someone will be able to spot the problem: https://developer.apple.com/documentation/visionos/creating-stereoscopic-image-in-visionos The problems shown in the log are: Undefined symbol: _main Linker command failed with exit code 1 (use -v to see invocation) The first error seems to say that there's no "main" but there is indeed a @main in the EntryPoint.swift file. Any ideas? I have archived other apps (built from scratch) successfully, but clearly there's something different about this sample code. Many thanks!
6
0
255
3w