func oneStepForward(_ input: Int) -> Int {
return input + 1
}
func oneStepBackward(_ input: Int) -> Int {
return input - 1
}
func chooseStepFunction(backward: Bool) -> (Int) -> Int {
return backward ? oneStepBackward : oneStepForward
//Error. type of expression is ambiguous without a type annotation
}
Why am I getting this error ?
If I change this function to the following it works and will compile.
func chooseStepFunction(backward: Bool) -> (Int) -> Int {
if backward {
return oneStepBackward
} else {
return oneStepForward
}
}
// Why am I getting the error in the previous version while it works in the second version ?
Thx in advance.
Overview
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
We currently supporting proxy app with Tunnel.appEx and PacketTunnelProvider.
Some users report about constant error "The VPN session failed because an internal error occurred." on VPN start (which fails rapidly).
This error occur mostly after user updated app with active VPN.
Rebooting device solves the problem and it doesnt come again, but it is still very frustrating.
I can provide any required info about app setup to solve this issue if you need. Thanks
Hey all!
in my personal quest to make future proof apps moving to Swift 6, one of my app has a problem when setting an artwork image in MPNowPlayingInfoCenter
Here's what I'm using to set the metadata
func setMetadata(title: String? = nil, artist: String? = nil, artwork: String? = nil) async throws {
let defaultArtwork = UIImage(named: "logo")!
var nowPlayingInfo = [
MPMediaItemPropertyTitle: title ?? "***",
MPMediaItemPropertyArtist: artist ?? "***",
MPMediaItemPropertyArtwork: MPMediaItemArtwork(boundsSize: defaultArtwork.size) { _ in
defaultArtwork
}
] as [String: Any]
if let artwork = artwork {
guard let url = URL(string: artwork) else { return }
let (data, response) = try await URLSession.shared.data(from: url)
guard (response as? HTTPURLResponse)?.statusCode == 200 else { return }
guard let image = UIImage(data: data) else { return }
nowPlayingInfo[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(boundsSize: image.size) { _ in
image
}
}
MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo
}
the app crashes when hitting
MPMediaItemPropertyArtwork: MPMediaItemArtwork(boundsSize: defaultArtwork.size) { _ in
defaultArtwork
}
or
nowPlayingInfo[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(boundsSize: image.size) { _ in
image
}
commenting out these two make the app work again.
Again, no clue on why.
Thanks in advance
I am debugging ImageCaptureCore to communicate with external cameras.
When I called the PTP function below to send a command and add data, the response timed out for more than 5 seconds. After waiting for a period of time, I obtained the response. However, the response callback function obtained responsivData.length as zero and ptpResponseData.length as zero too.
(void)requestSendPTPCommand:(NSData *)ptpCommand
outData:(NSData *)ptpData
completion:(void (^)(NSData *responseData, NSData *ptpResponseData, NSError *error))completion;
data is below:
Wrote 1 = 0x1 bytes PTP:send data: (hexdump of 1 bytes)
[ ] I/PTP (14564): 0000 01 - .
Topic:
App & System Services
SubTopic:
Hardware
When I use the .zoom transition in a navigation stack, I get a glitch when interrupting the animation by swiping back before it completes.
When doing this, the source view disappears. I can still tap it to trigger the navigation again, but its not visible on screen.
This seems to be a regression in iOS 26, as it works as expected when testing on iOS 18.
Has someone else seen this issue and found a workaround? Is it possible to disable interrupting the transition?
Filed a feedback on the issue FB19601591
Screen recording:
https://share.icloud.com/photos/04cio3fEcbR6u64PAgxuS2CLQ
Example code
@State var showDetail = false
@Namespace var namespace
var body: some View {
NavigationStack {
ScrollView {
showDetailButton
}
.navigationTitle("Title")
.navigationBarTitleDisplayMode(.inline)
.navigationDestination(isPresented: $showDetail) {
Text("Detail")
.navigationTransition(.zoom(sourceID: "zoom", in: namespace))
}
}
}
var showDetailButton: some View {
Button {
showDetail = true
} label: {
Text("Show detail")
.padding()
.background(.green)
.matchedTransitionSource(id: "zoom", in: namespace)
}
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
I have a PDF which contains geocoordinates. I'm extracting out that image with the following code (this is for an iOS application):
guard let cgDocument = CGPDFDocument(overlay.pdfUrl as CFURL) else { return }
guard let cgPage = cgDocument.page(at: 1) else { return }
var boundingRect = self.rect(for: overlay.boundingMapRect)
let pdfPageRect = cgPage.getBoxRect(.mediaBox)
let renderer = UIGraphicsImageRenderer(size: pdfPageRect.size)
var img = renderer.image { ctx in
UIColor.white.set()
ctx.fill(pdfPageRect)
ctx.cgContext.translateBy(x: 0.0, y: pdfPageRect.size.height)
ctx.cgContext.scaleBy(x: 1.0, y: -1.0)
ctx.cgContext.drawPDFPage(cgPage)
}
Once I have that image, I then need to adjust it to fit the specific coordinate corners. For that, I'm doing the following using a perspectiveTransform:
let ciImg = CIImage(image: img)!
let perspectiveTransformFilter = CIFilter.perspectiveTransform()
perspectiveTransformFilter.inputImage = ciImg
perspectiveTransformFilter.topRight = cartesianForPoint(point: ur, extent: boundingRect)
perspectiveTransformFilter.topLeft = cartesianForPoint(point: ul, extent: boundingRect)
perspectiveTransformFilter.bottomRight = cartesianForPoint(point: lr, extent: boundingRect)
perspectiveTransformFilter.bottomLeft = cartesianForPoint(point: ll, extent: boundingRect)
let txImg = perspectiveTransformFilter.outputImage!
img = UIImage(ciImage: txImg)
The original image is 792 x 612 (a landscape PDF) but the boundingRect covering the coordinates is 25625 x 20030. Obviously when I try to draw the image into that bounding box the app runs out of memory (25625 x 20030 x 4 is around 2GB of memory).
What I'm struggling with is - how do I correctly scale this image to fit into the bounding box even though the bounding box is, oh, 10x the resolution of the actual device? There's some key CoreGraphics thing I'm sure I'm missing here.
Is this possible while inserting a String into Set
Crashed: com.apple.root.user-initiated-qos.cooperative
0 libswiftCore.dylib 0xf4c0 _assertionFailure(_:_:flags:) + 136
1 libswiftCore.dylib 0x17f484 ELEMENT_TYPE_OF_SET_VIOLATES_HASHABLE_REQUIREMENTS(_:) + 3792
2 MyEatApp 0x44f6e8 specialized _NativeSet.insertNew(_:at:isUnique:) + 4333926120 (<compiler-generated>:4333926120)
3 MyEatApp 0x44eaec specialized Set._Variant.insert(_:) + 4333923052 (<compiler-generated>:4333923052)
4 MyEatApp 0x479f7c HomeViewModel.hanldeAnnouncementCard(from:) + 293 (HomeViewModel+PersonalizedOffer.swift:293)
5 libswift_Concurrency.dylib 0x5c134 swift::runJobInEstablishedExecutorContext(swift::Job*) + 292
6 libswift_Concurrency.dylib 0x5d5c8 swift_job_runImpl(swift::Job*, swift::SerialExecutorRef) + 156
7 libdispatch.dylib 0x13db0 _dispatch_root_queue_drain + 364
8 libdispatch.dylib 0x1454c _dispatch_worker_thread2 + 156
9 libsystem_pthread.dylib 0x9d0 _pthread_wqthread + 232
10 libsystem_pthread.dylib 0xaac start_wqthread + 8
Will RC be allowed to upload to App Store Connect?
I have tried a couple of times with 17A321 and I keep getting unsupported SDK or Xcode version.
Submitted feedback FB20178551
If the Safari Technology Preview window is located on an external monitor with DisplayLink and the computer goes to sleep (screen saver), when it returns, it closes with an error.
If the window is located on another monitor that is connected by USB, it does not close.
Equipo: Macbook Pro M4 Pro
SO: MacOS Sequoia 15.6.1
Safari Technology Preview: Release 227 (preview version work fine)
DisplayLink Manager: 13.0.1 (build 46)
Hi, I'm trying to mount my FSKit volume with a client app (SwiftUI).
I already successfully did it with the "mount" command and I can instantiate my file-system with FSPathURLResource.
Also, I managed to mount the file-system with DiskArbitration in a SwiftUI app, but I only managed to get it working with FSBlockDeviceResource.
Is there a way to programmatically do it in a client app? Or is "mount" command currently the only option?
But the NMI and NDI of Samsung's Wi Fi Aware are not the same MAC address. May I ask Apple engineers why they are different from Samsung?
Under Xcode 26 beta 3 I'm trying to build a project which uses Metal. I've installed the Metal Toolchain 26.0 under Settings -> Components, but when I start a build it fails during the "Prepare build" step with the following error (repeated many times):
stat(/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.1.5276.7.Pb9SLL/Metal.xctoolchain/usr/bin/clang): No such file or directory (2)
I've confirmed that there is in fact no 'clang' binary in that directory. I've tried using xcode-select to set the Xcode 26 Beta app as the active developer directory, and xcodebuild -version shows:
Xcode 26.0
Build version 17A5276g
Any ideas on other things to try?
Here is a simple view to demonstrate the issue
struct ContentView: View {
@State private var isPresented = false
var body: some View {
VStack {
Button("Test") { isPresented = true }
}
.alert("Test", isPresented: $isPresented, actions: {
Button("Delete All", role: .destructive) {}
}, message: {
Text("Are You Sure?")
})
.padding()
}
}```
Which results in

The destructive button is almost unreadable. WCAG score is 1.4, far below the minimum recommended 4.5.
I found [this post](https://stackoverflow.com/q/66448869) on SO going back to Big Sur, but not on this forum.
Any known workarounds (except for building my own dialogs, which I am trying to avoid)?
Using confirmationDialog instead of alert does not make a difference.
My post-build script takes the "developeridexport" archive export, zips it up and uses notarytool to notarize it. I then add the .zip to a .dmg disk image. The next step is to codesign the disk image before notarizing that too. The issue is my Developer ID Application certificate is not accessible to the build host. (When I was doing this in Microsoft AppCenter (now defunct), it had a copy of my Developer ID Application certificate.) What steps do I need to take to get the disk image signed for notarization?
Thanks!
Lance
Topic:
Developer Tools & Services
SubTopic:
Xcode Cloud
Tags:
Signing Certificates
Code Signing
Developer ID
(Using macOS 26 Beta 9 and Xcode 26 Beta 7) I am trying to support basic onDrop from a source app to my app. I am trying to get the closest "source" representation of a drag-and-drop, e.g. a JPEG file being dropped into my app shouldn't be converted, but stored as a JPEG in Data. Otherwise, everything gets converted into TIFFs and modern iPhone photos get huge. I also try to be a good app, and provide asynchronous support.
Alas, I've been running around for days now, where I can now support Drag-and-Drop from the Finder, from uncached iCloud files with Progress bar, but so far, drag and dropping from Safari eludes me.
My code is as follows for the onDrop support:
Image(nsImage: data.image).onDrop(of: Self.supportedDropItemUTIs, delegate: self)
The UTIs are as follows:
public static let supportedDropItemUTIs: [UTType] = [
.image,
.heif,
.rawImage,
.png,
.tiff,
.svg,
.heic,
.jpegxl,
.bmp,
.gif,
.jpeg,
.webP,
]
Finally, the code is as follows:
public func performDrop(info: DropInfo) -> Bool {
let itemProviders = info.itemProviders(for: Self.supportedDropItemUTIs)
guard let itemProvider = itemProviders.first else {
return false
}
let registeredContentTypes = itemProvider.registeredContentTypes
guard let contentType = registeredContentTypes.first else {
return false
}
var suggestedName = itemProvider.suggestedName
if suggestedName == nil {
switch contentType {
case UTType.bmp: suggestedName = "image.bmp"
case UTType.gif: suggestedName = "image.gif"
case UTType.heic: suggestedName = "image.heic"
case UTType.jpeg: suggestedName = "image.jpeg"
case UTType.jpegxl: suggestedName = "image.jxl"
case UTType.png: suggestedName = "image.png"
case UTType.rawImage: suggestedName = "image.raw"
case UTType.svg: suggestedName = "image.svg"
case UTType.tiff: suggestedName = "image.tiff"
case UTType.webP: suggestedName = "image.webp"
default: break
}
}
let progress = itemProvider.loadInPlaceFileRepresentation(forTypeIdentifier: contentType.identifier) { url, _, error in
if let error {
print("Failed to get URL from dropped file: \(error)")
return
}
guard let url else {
print("Failed to get URL from dropped file!")
return
}
let queue = OperationQueue()
queue.underlyingQueue = .global(qos: .utility)
let intent = NSFileAccessIntent.readingIntent(with: url, options: .withoutChanges)
let coordinator = NSFileCoordinator()
coordinator.coordinate(with: [intent],
queue: queue) { error in
if let error {
print("Failed to coordinate data from dropped file: \(error)")
return
}
do {
// Load file contents into Data object
let data = try Data(contentsOf: intent.url)
Dispatch.DispatchQueue.main.async {
self.data.data = data
self.data.fileName = suggestedName
}
} catch {
print("Failed to load coordinated data from dropped file: \(error)")
}
}
}
DispatchQueue.main.async {
self.progress = progress
}
return true
}
For your information, this code is at the state where I gave up and sent it here, because I cannot find a solution to my issue.
Now, this code works everywhere, except for dragging and dropping from Safari.
Let's pretend I go to this web site:
https://commons.wikimedia.org/wiki/File:Tulip_Tulipa_clusiana_%27Lady_Jane%27_Rock_Ledge_Flower_Edit_2000px.jpg
and I try to drag-and-drop the image, it will fail with the following error:
URL https://upload.wikimedia.org/wikipedia/commons/c/cf/Tulip_Tulipa_clusiana_%27Lady_Jane%27_Rock_Ledge_Flower_Edit_2000px.jpg is not a file:// URL.
And then, fail with the dreaded
Failed to get URL from dropped file: Error Domain=NSItemProviderErrorDomain Code=-1000
As far as I can tell, the problem lies in the opaque NSItemProvider receiving a web site URL from Safari. I tried most solutions, I couldn't retrieve that URL. The error happens in the callback of loadInPlaceFileRepresentation, but also fails in loadFileRepresentation. I tried hard-requesting a loadObject of type URL, but there's only one representation for the JPEG file. I tried only putting .url in the requests, but it would not transfer it.
Anyone solved this mystery?
Where can I find the documentation of the Genlock feature of the iPhone 17 Pro? How does it work and how can I use it in my app?
Hi everyone, on iOS, when a VoIP call arrives and the user accepts it from the lock screen (after unlocking with Face ID/Touch ID), is there any way to automatically bring my app to the foreground and show the in-app call screen, instead of staying in the system CallKit UI?
GKAccessPoint triggerAccessPointWithState handler not invoked on iOS 26.0 and iOS 15.8.4
Incorrect/Unexpected Behaviour:
When calling [GKAccessPoint.shared triggerAccessPointWithState:GKGameCenterViewControllerStateAchievements handler:^{}] on a real device running iOS 26 beta (iOS 26), the overlay appears as expected, but the handler block is never called. This behavior also not working correctly on previous iOS versions(tested on iOS 15.8.4)
Steps to Reproduce:
Authenticate GKLocalPlayer
Call triggerAccessPointWithState:handler: with a block that logs or performs logic
Observe that overlay appears, but block is not executed
Behavior:
UI appears correctly
Handler is not invoked at all
Expected Result:
The handler should fire immediately after the dashboard is shown.
Actual Result:
The handler is never called.
Usecase:
As GKGameCenterViewController is deprecated we are moving to GKAccesspoint but due to above functionality issue we are unable to.
Environment:
Device: iPhone 16, iPhone 7
iOS: 26.0 and iOS 15.8.4
Xcode: 26.0 beta and Xcode 16.4
For years I've been using Receigen for receipt verification for the Mac App Store build of my application. However, with the deprecation of exit code 173, I am moving to StoreKit-based verification and have a couple of questions.
I have followed the instructions from https://developer.apple.com/documentation/storekit/apptransaction/shared and have something like this (simplified):
Swift:
@objc class ValidateReceipt: NSObject {
@objc func validate() async -> Bool {
do {
let verificationResult = try await AppTransaction.shared
switch verificationResult {
case .verified(_ /*let appTransaction*/):
// StoreKit verified that the user purchased this app and
// the properties in the AppTransaction instance
return true;
default:
// The app transaction didn't pass StoreKit's verification
return false;
}
}
catch {
// Handle errors
return false;
}
}
}
Objective-C:
ValidateReceipt *validateReceipt = [[ValidateReceipt alloc] init];
[validateReceipt validateWithCompletionHandler:^(BOOL result) {
if (result)
{
// Successful app purchase validation
}
else
{
// App purchase validation failure
}
}];
Thing is, I always get a valid result, i.e., in ValidReceipt.validate(), the case .verified block always runs. Even when exporting a new release build of my app and running it (without any _MASReceipt).
When using exit code 173, an .app without a _MASReceipt would prompt for app store login. Nothing of the sort happens now.
Am I misunderstanding the documentation / doing something wrong / missing something obvious?
Our app server is having some TLS related issue with the new iOS 26 (It works with iOS 18 and below).
When opening the domain url in iPhone Safari browser with iOS 26, it showing the error as below:
We followed the instructions from this link (https://support.apple.com/en-sg/122756), to run the following command: nscurl --tls-diagnostics https://test.example in Terminal app. It shows TLS failed with error: -9808
Could anyone please help explain what exactly the issue is with our server certificate, and how we should fix it? Thanks so much!