let videoURL = URL(fileURLWithPath: path ?? "")
let asset = AVURLAsset(url: videoURL, options: nil)
let imageGenerator = AVAssetImageGenerator(asset: asset)
imageGenerator.appliesPreferredTrackTransform = true
let time = CMTimeMultiplyByRatio(asset.duration, multiplier: 1, divisor: 2) // THIS LINE GIVES ISSUE: "'duration' was deprecated in iOS 16.0: Use load(.duration) instead". I CANNOT FIGURE OUT THE CORRECT SYNTAX FOR CHANGING asset.duration TO REPLACE WITH load(.duration). HELP WITH THE CORRECT SYNTAX WOULD BE HELPFUL.
Xcode
RSS for tagBuild, test, and submit your app using Xcode, Apple's integrated development environment.
Post
Replies
Boosts
Views
Activity
Inquiry about Open Source Release of Xcode 15's ld Source Code
Dear Apple Developer Support Team,
I hope this email finds you well.
I am a developer with a keen interest in Apple's development toolchain. I noticed that Xcode 15 uses a new version of the linker (ld), and I'm particularly interested in its source code.
I would like to inquire about:
When will the source code for the ld linker used in Xcode 15 be made available as open source?
Your response would be greatly appreciated.
Thank you for your time and attention to this matter.
Best regards, Panghu
I recently compiled my macOS App with Swift 6 in Xcode 16 (was using Swift 5 previously) and noticed that AppKit Integration doesn't appear to be working as before. All my instances of NSHostingView which allow me to add a SwiftUI View to an AppKit NSWindow view controller no longer respond to mouse input anymore. All my NSHostingView instances display but refuse to accept any user interaction. Has anyone else noticed this and is there a workaround to get NSHostingView to once again be able to accept user/mouse events with Swift 6?
In Xcode 16, even if Objective-C is selected, the Navigator in the documentation viewer displays Swift information.
I don't know when this bug was introduced, but it's there in the last Xcode 16 betas at least.
I hope as many developers as possible submit this bug to Apple to get their attention.
P.S. Yes, I know there's Dash. For many years, Dash was a much better option than Xcode's built-in viewer. However, in version 5, the Dash developer introduced some unfortunate UI changes that made Xcode a better option to view the documentation in certain cases. Unfortunately, the Dash developer doesn't seem to be interested in user feedback anymore. He's been ignoring suggestions and user requests for years by now.
Hi,
Is it possible to manually create collapsable areas in Xcode when it doesn't show automatically , for example variables definition area in views ?
Kind Regards
Really stumped on this issue my team is seeing with the Xcode 16 Beta (both Xcode 16 version 6 and Xcode 16.1). Wondering if anyone was having a similar issue and if this is a bug or something configured incorrectly.
Basically, when I go to build settings and search for anything related to "Swift Compiler" nothing shows up. The only thing that appears with "Swift" in the title is under the User Defined keys (see attached)
As such, I'm unable to change the Swift version for the project and I'm stuck in Swift 6 language mode which we're not quite ready for yet.
This is only occurring on one of our targets. Our other app projects are behaving as expected. The project in question has the main target we build the project with and 2 support frameworks. The supporting frameworks are also working correctly. Its just the primary build target giving us fits.
Curious if anyone is seeing something similar or has suggestions. Thanks!
In "Create asset catalogs and sets" - https://help.apple.com/xcode/mac/current/#/dev10510b1f7 - I read this:
" Create an iOS or tvOS launch screen image set: Choose App Icons & Launch Images > New [OS] Launch Image from the Add button (+) or from the Editor > Add Assets menu. For an iOS app, you can also change the default launch screen source to an image set. "
But neither the Editor -> Add New Asset menu nor the Add button (+) menu contains an "App Icons & Launch Images" item. I can add that I use Xcode 16.1.
So again, the Xcode documentation is quite misleading and confusing!
My (real) question is if it is possible to give Xcode ONE launch image from which Xcode creates all necessary image sizes automatically? Or do we still need the apps and services that creates a bunch of launch images from ONE image?
Launchd won't run a daemon that calls setuid in Sonoma, but it will allow it in Sequoia and Monterey
We have a daemon (/Library/LaunchDaemons) that has been calling setuid (usr/include/unistd.h) for some time. Launchd allowed that until we started compiling using Xcode 16 (maybe even Xcode 15). But now we have to remove that call for launchd to allow the daemon to run. That's not really an issue to remove that call but it is very mysterious that it only fails in Sonoma. Works in Sequoia and Monterey. Why is that?
We found this after adding some logging to our daemon plist:
The application with bundle ID <redacted> is running setugid(), which is not allowed. Exiting.
We're actually calling setuid.
When attempting to fix an issue that is only happening on a specific iOS build I noticed that I am not able to install that specific build on my simulator. Is there any way to get specific iOS builds that are not available through Xcode?
Example: The bug I am trying to fix is only happening on 17.6.1 and 17.7.1. These specific builds are not available through Xcode.
Attempted Resolution: I found a iPhone14,5_17.6.1_21G101_Restore.ipsw file but was not able to import it into Xcode for use nor was I able to use it on a physical device.
In several places on https://developer.apple.com/documentation/xcode/configuring-your-app-icon I read:
"In the Project navigator, select an asset catalog."
But my Project Navigator does NOT contain any "asset catalog". So it's impossible to follow the instructions of the documentation, and thus specify a new app icon (set).
I can add that I use Xcode 16.1 on MacOS 15.0.1 Sequoia.
I have added a screen shot to document what I am saying.
I have also reported this error in https://feedbackassistant.apple.com/feedback/15738182
I have this error for 5 min :
title: Waiting to reconnect to {Iphone_Name}
content: Previous preparation error: The developer disk image could not be mounted on this device.. Error mounting image: 0xe800010f (kAMDMobileImageMounterPersonalizedBundleMissingVariantError: The bundle image is missing the requested variant for this device.)
after a while :
title: The developer disk image could not be mounted on this device.
content: Error mounting image: 0xe800010f (kAMDMobileImageMounterPersonalizedBundleMissingVariantError: The bundle image is missing the requested variant for this device.)
What has been tryed :
- Xcode : clean
- Xcode : close
- Iphone : unpluged
- Iphone : Remove trusted device
- Iphone : Remove Dev mode
- Iphone : Re-active dev mode (then reboot)
- Iphone : Accepte dev mode
- Iphone : wait 5 min
- Iphone : connect to the macbook pro (M1)
- Iphone : accepte first form
- XCode : start it
- Iphone : accepte second form
- XCode : select my project
THEN BUG SAME PLAIN OLD APPLE BUG (again and again)
(I have try it like 20 times, i'm fed up now)
I have paid for a pro (100euros) account to be able to push to my brand new iphone.
I have tried everything, like :
remove xcode, re-install it. No Update for the iphone.
sudo installer -pkg /Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg -target /
What I can do :
- Buy a subscription to store my iphone on icloud (cause basic option is already full)
- Ask a refound for the iphone (obviously not working) and my apple subscription developers. And fix my old iphone. No point to buy brand new device that is not working.
Also, same error with my brand new ipad pro 16 pouce.
I can't push to the store, cause you ask screen shot. But I can't start the apps, so i can't have screen shot. So i have to change my plans in terms of project.
Please help, before I switch to a full web stack based on rust
I am developing an app for Vehicle owners with a built-in map navigation feature with voice navigation support. The app works fine without voice navigation but when I use voice navigation it occasionally crashes and it crashes while voice navigation is not in progress.
What makes it impossible to diagnose is that even though it crashed 10 times on the flight, I don't see any crash reports in 'Apple Connect'. I tried running it in a simulator and it didn't crash there! but on a real device, when I drive with the app navigating me I crashes abruptly after a few minutes and it's not while the voice navigation is speaking! I also ran the app without AVFoundation and it did not crash then. So I am 100% sure it is something with this AVFoundation framework.
If anyone can help find the problem in my following code it would be really helpful.
import SwiftUI
import AVFoundation
struct DirectionHeaderView: View {
@Environment(\.colorScheme) var bgMode: ColorScheme
var directionSign: String?
var nextStepDistance: String
var instruction: String
@Binding var showDirectionsList: Bool
@Binding var height: CGFloat
@StateObject var locationDataManager: LocationDataManager
@State private var synthesizer = AVSpeechSynthesizer()
@State private var audioSession = AVAudioSession.sharedInstance()
@State private var lastInstruction: String = ""
@State private var utteranceDistance: String = ""
@State private var isStepExited = false
@State private var range = 20.0
var body: some View {
VStack {
HStack {
VStack {
if let directionSign = directionSign {
Image(systemName: directionSign)
}
if !instruction.contains("Re-calculating the route...") {
Text("\(nextStepDistance)")
.onChange(of: nextStepDistance) {
let distance = getDistanceInNumber(distance: nextStepDistance)
if distance <= range && !isStepExited {
startVoiceNavigation(with: instruction)
isStepExited = true
}
}
}
}
Spacer()
Text(instruction)
.onAppear {
isStepExited = false
utteranceDistance = nextStepDistance
range = nextStepRange(distance: utteranceDistance)
startVoiceNavigation(with: "In \(utteranceDistance), \(instruction)")
}
.onChange(of: instruction) {
isStepExited = false
utteranceDistance = nextStepDistance
range = nextStepRange(distance: utteranceDistance)
startVoiceNavigation(with: "In \(utteranceDistance), \(instruction)")
}
.padding(10)
Spacer()
}
}
.padding(.horizontal,10)
.background(bgMode == .dark ? Color.black.gradient : Color.white.gradient)
}
func startVoiceNavigation(with utterance: String) {
if instruction.isEmpty || utterance.isEmpty {
return
}
if instruction.contains("Re-calculating the route...") {
synthesizer.stopSpeaking(at: AVSpeechBoundary.immediate)
return
}
let thisUttarance = AVSpeechUtterance(string: utterance)
lastInstruction = instruction
if audioSession.category == .playback && audioSession.categoryOptions == .mixWithOthers {
DispatchQueue.main.async {
synthesizer.speak(thisUttarance)
}
}
else {
setupAudioSession()
DispatchQueue.main.async {
synthesizer.speak(thisUttarance)
}
}
}
func setupAudioSession() {
do {
try audioSession.setCategory(AVAudioSession.Category.playback, options: AVAudioSession.CategoryOptions.mixWithOthers)
try audioSession.setActive(true)
}
catch {
print("error:\(error.localizedDescription)")
}
}
func nextStepRange(distance: String) -> Double {
var thisStepDistance = getDistanceInNumber(distance: distance)
if thisStepDistance != 0 {
switch thisStepDistance {
case 0...200:
if locationDataManager.speed >= 90 {
return thisStepDistance/1.5
}
else {
return thisStepDistance/2
}
case 201...300:
if locationDataManager.speed >= 90 {
return 120
}
else {
return 100
}
case 301...500:
if locationDataManager.speed >= 90 {
return 150
}
else {
return 125
}
case 501...1000:
if locationDataManager.speed >= 90 {
return 250
}
else {
return 200
}
case 1001...10000:
if locationDataManager.speed >= 90 {
return 250
}
else {
return 200
}
default:
if locationDataManager.speed >= 90 {
return 250
}
else {
return 200
}
}
}
return 200
}
func getDistanceInNumber(distance: String) -> Double {
var thisStepDistance = 0.0
if distance.contains("km") {
let stepDistanceSplits = distance.split(separator: " ")
let stepDistanceText = String(stepDistanceSplits[0])
if let dist = Double(stepDistanceText) {
thisStepDistance = dist * 1000
}
}
else {
var stepDistanceSplits = distance.split(separator: " ")
var stepDistanceText = String(stepDistanceSplits[0])
if let dist = Double(stepDistanceText) {
thisStepDistance = dist
}
}
return thisStepDistance
}
}
#Preview {
DirectionHeaderView(directionSign: "", nextStepDistance: "", instruction: "", showDirectionsList: .constant(false), height: .constant(0), locationDataManager: LocationDataManager())
}
The simulator will not work. No matter How much I restart, when I open my app, it tells me either Build succeeded but I see a loading bar or a loading automatic phone simulator but it never shows up like the line would. keep going in a loop, for example this is what it looks like,
Sometimes, I receive old location data from the location manager.
i am unable to deploy the iOS app with automation using below command:
ios-deploy --bundle /Users/XXXX/Library/Developer/Xcode/DerivedData/iOSClient2-XXXXXXX/Build/Products/Debug-iphoneos/iOSClient2.app/ --id 00008020-XXXXXXXXX --justlaunch --verbose
with the error:
------ Debug phase ------
Starting debug of 00008120-000C713236E0A01E (D38AP, D38AP, uknownos, unkarch, 18.1, 22B83) a.k.a. 'Svt’s iPhone' connected through USB...
Device Class: iPhone
build: 22B83
version: 18.1
Found Xcode developer dir /Applications/Xcode.app/Contents/Developer
version: 18.0
version: 18
2024-11-08 15:26:09.531 ios-deploy[33496:644410] [ !! ] Unable to locate DeviceSupport directory with suffix 'DeveloperDiskImage.dmg'. This probably means you don't have Xcode installed, you will need to launch the app manually and logging output will not be shown!
Observation:
Xcode 16 missing the DeviceSupport for iOS17 and above.
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/....
Xcode: Version 16.1 (16B40
iOS: iOS17 and above
Hello
I have a problem with provisionprofile file. I have created Identifier with Sign in with Apple capability turned on, created Profile with Developer ID selected and now I try to export archive with generated Developer ID provision file but it says "Profile doesn't support Sign in with Apple"
Also interesting thing that default provisions like
macOS App Development
Mac App Store Connect
don't show such error when I try to export archive
Maybe this problem is only related to Developer ID provision and Direct Distribution doesn't support Sign in with Apple, but I havent found proves about this idea
Our CI process uses XcodeBuild tools. It used to work very well. The shell code is as follows:
step 1 "++++++++++++++++clean++++++++++++++++"
xcodebuild clean -workspace ${WORKSPACE_NAME}.xcworkspace \
-scheme ${SCHEME_NAME} \
-configuration ${configuration}
step 2 "+++++++++++++++++archive+++++++++++++++++"
xcodebuild archive -workspace ${WORKSPACE_NAME}.xcworkspace \
-scheme ${SCHEME_NAME} \
-configuration ${configuration} \
-archivePath ${ARCHIVE_PATH}
-allowProvisioningUpdates YES
step 3 "+++++++++++++++++ipa+++++++++++++++++"
xcodebuild -exportArchive \
-archivePath ${ARCHIVE_PATH} \
-exportPath "${IPA_PATH}" \
-exportOptionsPlist ${EXPORT_METHOD_PLIST_PATH} \
-allowProvisioningUpdates YES
But after upgrading to xcode16, every time I execute the step3, it fails.
The error log is like this
** ARCHIVE SUCCEEDED **
2024-11-08 16:19:54.360 xcodebuild[36487:6743710] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path "/var/folders/ch/1mvd9gz11cn8zy9h254qz2600000gn/T/***.xcdistributionlogs".
error: exportArchive No Accounts
error: exportArchive Provisioning profile "iOS Team Store Provisioning Profile: com.***" doesn't include signing certificate "Apple Distribution: *** Co Ltd (***)".
** EXPORT FAILED **
At this time, my Apple developer account disappeared in xcode-setting-account, and it automatically logged out. If I log in again and execute the shell command, the above phenomenon will reappear.
What is the cause of this, and what do I need to do to solve this problem? I look forward to your reply
Hey guys, so I've read a lot of previous issues opened before opening this one, and I am doing it because none of the info found solved my problem.
So, I am trying to build my app which it has a custom Info.plist file. But i keep getting the issue of multiple command when trying to build. Here is how it;s configured:
Info.plist has the target membership correct
Build Setting is set to 'NO' under "Generate Info.plist File"
The path is correct, in the same folder as the ContentView
And here is what I've already tried to fix the issue:
Check in Build Phases if the wasn't a duplication: There isn't
Removing the Info.plist from the "Copy Bundle Resources": When I do this, than I get another issue which is "Build input file cannot be found. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?"
Switching the Build to Legacy Build System: Nothing changed
Deleting the manually created Info.plist file and changing the Build Settings to 'YES' under "Generate Info.plist File": I get the same issue "Build input file cannot be found. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?"
Deleted the Derived Data multiple times
Deleted the Info.plist file and re-added it through File > New File
Anyway, this is my last resource to find some help here in the forum. Any insight is valid
P.S: XCode version 16.1
PLATFORM AND VERSION
iOS
Development environment: Xcode 15.4, macOS 14.6.1
Run-time configuration: iOS 15.8.2
DESCRIPTION OF PROBLEM
The only test phone that I have available is an iPhone 7 running iOS 15.8.2 (the latest iOS available for that device). When I connect the phone to XCode, it displays "Preparing Richard Cunningham's iPhone" indeterminately. I have tried many things including downloading new device support files, adding provisioning profiles, downgrading XCode, restarting both devices, wiping the phone, and setting the target SDK to match that of the test device. Despite all of this, XCode continues to display "Preparing ..." indeterminately. The issue can be found here on the developer forums:
https://forums.developer.apple.com/forums/thread/692230
STEPS TO REPRODUCE
Create a blank XCode iOS project (Multiplatform App, iOS App, it doesn't seem to make a difference) and connect the iPhone 7 (15.8.2) to the laptop. Select "Trust" on the phone to initialize the connection, and observe XCode display "Preparing iPhone" in the top bar. Cmd + Shift + 2 to open the Devices Window, and see "iPhone is busy: Preparing iPhone". Allow this to continue for some time (I have left it for over a day) and observe that there are no changes.
I want to release a Framework F, containing several other frameworks (such as Realm, Appetitive, Cocoalumberjack, PhoneNumberKit) for use by app A.
According to this article: https://medium.com/@bittudavis/how-to-create-an-umbrella-framework-in-swift-ca964d0a2345
They write, without referencing a source: "Although Apple discourage creating umbrella framework".
Is that true, do Apple discourage umbrella frameworks, if so why and is it a very strong discourage or a mild one?
If not discouraged, then how can this be achieved with Xcode 16?
I've been attempting to follow a few tutorial to achieve this, such as https://medium.com/john-lewis-software-engineering/adding-a-third-party-framework-inside-a-first-party-framework-in-xcode-3ba58cfd08da
however so far without any success. This last article mentions the Link Binary With Libraries section, which doesn't exist in Xcode 16.
There's the Frameworks, Libraries, and Embedded Content section where I have been attempting to add the frameworks into my Framework F (choosing Embed without Signing).
I'm able to successfully build Framework F, but when app A attempts to use it (adding F to the Frameworks, Libraries, and Embedded Content section with option embed and sign, or embed and don't sign, makes no difference) then I get run time errors about the umbrellaed frameworks not being able to be found.