I am using Store Kit 2 to implement In App Purchases for my app. I need to maintain a pending state in the UI for all my pending purchases. Is there a way to get a list of all pending purchases? If not, is there a way to know if my pending purchase was cancelled?
How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here
Delve into the world of built-in app and system services available to developers. Discuss leveraging these services to enhance your app's functionality and user experience.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
In our iOS application, we need to list available WiFi networks so that users can select one for device configuration.
Here's the workflow:
Initially, the hardware device acts as a WiFi Access Point (AP).
The app should scan for nearby WiFi networks to detect the device's AP.
The app connects temporarily to this AP and sends the selected WiFi credentials to the device.
The device then connects to the selected WiFi network and stops broadcasting its AP.
Is this flow achievable on iOS? We understand that Apple restricts access to WiFi scanning APIs — are there any supported methods (e.g., using NEHotspotHelper) or entitlements (such as MFi) that could enable this?
Hi I'm trying to build a screen time app and the Apple docs and APIs really leave something to be desired. I want to block apps on a schedule. That's it. To do this I need my DeviceActivityMonitorExt to know which apps to block. I need to somehow pass a DeviceActivitySelection from the main app into this DeviceActivityMonitorExt. How can I do this?
The battery drains quickly on iPhone SE 3. Whenever I take it off the charger it drains from 100% to 80% in 20 minutes. Please fix this bug?
Topic:
App & System Services
SubTopic:
Hardware
How can I use the Screen Time API to set a restriction for a child account from my app running on the parent’s account?
I would like to have a SwiftData predicate that filters against an array of PersistentIdentifiers.
A trivial use case could filtering Posts by one or more Categories. This sounds like something that must be trivial to do.
When doing the following, however:
let categoryIds: [PersistentIdentifier] = categoryFilter.map { $0.id }
let pred = #Predicate<Post> {
if let catId = $0.category?.persistentModelID {
return categoryIds.contains(catId)
} else {
return false
}
}
The code compiles, but produces the following runtime exception (XCode 26 beta, iOS 26 simulator):
'NSInvalidArgumentException', reason: 'unimplemented SQL generation for predicate : (TERNARY(item != nil, item, nil) IN {}) (bad LHS)'
Strangely, the same code works if the array to filter against is an array of a primitive type, e.g. String or Int.
What is going wrong here and what could be a possible workaround?
If I set my build settings "default actor isolation" to MainActor, how do my @ModelActor actors and model classes need to look like ?
For now, I am creating instances of my @ModelActor actors and passing my modelContext container and processing all data there. Everything stays in this context. No models are transferred back to MainActor.
Now, after changing my project settings, I am getting a huge amount of warnings.
Do I need to set all my model classes to non-isolated and the @ModelActor actor as well?
Is there any new sample code to cover this topic ... did not find anything for now.
Thanks in advance, Marc
I'm trying to migrate over to the Swift 6 language mode, but the biggest issue I'm facing is that any use of SwiftData #Predicate or SortDescriptor results in this warning from the compiler:
Type 'ReferenceWritableKeyPath<GuruSchemaV2.Rubric, Bool>' does not conform to the 'Sendable' protocol; this is an error in the Swift 6 language mode
Here is an example predicate, from a static method on the Rubric type:
static func notArchived() -> Predicate<Rubric> {
return #Predicate<Rubric> { rubric in
!rubric.archived
}
}
And the error highlights line 5 of the expanded macro:
Foundation.Predicate<Rubric>({ rubric in
PredicateExpressions.build_Negation(
PredicateExpressions.build_KeyPath(
root: PredicateExpressions.build_Arg(rubric),
keyPath: \.archived
)
)
})
What is the correct way to reference properties of a model type using #Predicate?
Just wanted to check here to see if anyone else is running into the issue of CarPlay not working at all on iOS 26 Beta 1, even with the update on Friday.
I plug my phone in (wired) and CarPlay never shows up. I've seen a Reddit thread where other folks are seeing the same thing.
I’m creating an app with the Screen Time API and I would like to know how to make the app show a parental control editing view for parents and a view for child accounts that shows which apps are blocked. How can I do this?
Hello everyone,
I'm developing a macOS application that programmatically sets custom icons for folders, and I've hit a wall trying to get Finder to display the icon changes consistently.
The Goal:
To change a folder's icon using NSWorkspace.shared.setIcon and have Finder immediately show the new icon.
What I've Tried (The Refresh Mechanism):
After setting the icon, I attempt to force a Finder refresh using several sandbox-friendly techniques:
Updating the Modification Date (the "touch" method):
try FileManager.default.setAttributes([.modificationDate: Date()], ofItemAtPath: pathToUse)
Notifying NSWorkspace:
NSWorkspace.shared.noteFileSystemChanged(pathToUse)
Posting Distributed Notifications:
DistributedNotificationCenter.default().post(name: Notification.Name("com.apple.Finder.FolderChanged"), object: pathToUse)
The Problem:
This combination of methods works perfectly, but only under specific conditions:
When setting a custom icon on a folder for the first time.
When changing the icon of an alias.
For any subsequent icon change on a regular folder, Finder stubbornly displays the old, cached icon. I've confirmed that the user can see the new icon by manually closing and reopening the folder window, but this is obviously not a user-friendly solution.
Investigating a Reset with AppleScript:
I've noticed that the AppleScript update command seems to force the kind of complete refresh I need:
tell application "Finder"
update POSIX file "/path/to/your/folder"
end tell
Running this seems to reset the folder's state in Finder, effectively recreating the "first-time set" scenario where my other methods work.
However, the major roadblock is that I can't figure out how to reliably execute this from a sandboxed environment. I understand it likely requires specific scripting entitlements, but it's unclear which ones would be needed for this update command on a user-chosen folder, or if it's even permissible for the App Store.
My Questions:
Is there a reliable, sandbox-safe way to make the standard Cocoa methods (noteFileSystemChanged, updating the modification date, etc.) work for subsequent icon updates on regular folders? Am I missing a step?
If not, what is the correct way to configure a sandboxed app's entitlements to safely run the tell application "Finder" to update command for a folder the user has granted access to?
Any insight or alternative approaches would be greatly appreciated. Thank you
Hey everyone,
I have an issue I'm running into – maybe someone has the expertise to help!
I've created an app that adds Intents to the Shortcuts app, to interact with S3-compatible object storage. Everything works fine, until you decide to upload/download a large file, that your internet connection cannot handle in the ~30-second intent timeout.
I've explored uploading files with a background task which seems to work somehow, but the bigger issue would be downloading larger files, as other parts of the subsequent shortcut may rely on it.
To the question: Is there some way of increasing the timeout for a shortcuts intent, or a way to "trick" shortcuts into letting my custom intents download/upload files without timing out?
Thanks so much!
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Shortcuts
Background Tasks
Intents
App Intents
Is there any way to use the screen time API on Mac?
I have an iOS app using SwiftData with VersionedSchema. The schema is synchronized with an CloudKit container.
I previously introduced some model properties that I have now removed, as they are no longer needed. This results in the current schema version being identical to one of the previous ones (except for its version number).
This results in the following exception:
'NSInvalidArgumentException', reason: 'Duplicate version checksums across stages detected.'
So it looks like we cannot have a newer schema version with an identical content to an older schema version.
The intuitive way would be to re-add the old (identical) schema version to the end of the "schemas" list property in the SchemaMigrationPlan, in order to signal that it is the newest one, and to add a migration stage back to it, thus:
public enum MySchemaMigrationPlan: SchemaMigrationPlan {
public static var schemas: [any VersionedSchema.Type] {
[
SchemaV100.self,
SchemaV101.self,
SchemaV100.self
]
}
public static var stages: [MigrationStage] {
[
migrateV100toV101,
migrateV101toV100
]
}
However, I am not sure if this is the right way to go, as previously, as I wanted to write unit tests for schema migration and rollback, I tried defining an inverse for each migration stage, so that I could trigger a migration and a rollback from a unit test, which resulted in an exception saying that it is not supported to downgrade a VersionedSchema.
I must admit that I solved the original problem by introducing a dummy model property that I will later remove. What would have been the correct approach?
I have an app that lets you create cars. I have a CarEntity, an OpenCarIntent, and a CreateCarIntent. I want to support the Open When Run option when creating a car. I understand to do this, you just update the return type of your perform function to include & OpensIntent, then change your return value to include opensIntent: OpenCarIntent(target: carEntity). When I do this, I get a compile-time error:
Cannot convert value of type 'CarEntity' to expected argument type 'IntentParameter<CarEntity>'
What am I doing wrong here?
struct CreateCarIntent: ForegroundContinuableIntent {
static let title: LocalizedStringResource = "Create Car"
@Parameter(title: "Name")
var name: String
@MainActor
func perform() async throws -> some IntentResult & ReturnsValue<CarEntity> & OpensIntent {
let managedObjectContext = PersistenceController.shared.container.viewContext
let car = Car(context: managedObjectContext)
car.name = name
try await managedObjectContext.perform {
try managedObjectContext.save()
}
let carEntity = CarEntity(car: car)
return .result(
value: carEntity,
opensIntent: OpenCarIntent(target: carEntity) // FIXME: Won't compile
)
}
}
struct OpenCarIntent: OpenIntent {
static let title: LocalizedStringResource = "Open Car"
@Parameter(title: "Car")
var target: CarEntity
@MainActor
func perform() async throws -> some IntentResult {
await UIApplication.shared.open(URL(string: "carapp://cars/view?id=\(target.id)")!)
return .result()
}
}
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
iOS
Shortcuts
Intents
App Intents
We’ve integrated in-app card provisioning into our application.
All required configurations have been completed, including:
Token Service Provider (TSP) setup
Certificates uploaded to the Apple Developer portal
While the card is successfully added to the Wallet app, our application is currently unable to retrieve or read the added passes.
Topic:
App & System Services
SubTopic:
Apple Pay
New subclassing is a great addition to SwiftData, while trying to utilize the superclass type for selection state I’m seeing the following error:
@available(macOS 26.0, *)
@Model
public class Asset {
…
}
var assetSelection: [Asset.ID] = []
Error: 'ID' is inaccessible due to '@_spi' protection level
Replacing the type with a subclassed swift data model of Asset works, but to handle mixed selection and the new .dragContainer modifier I need to be able to use the superclass.
Is this intended behavior?
Hey folks!
I'm working on a macOS app which has a Finder Quick Action extension. It's all working fine, but I'm hitting a weird struggle with getting the icon rendering how I would like, and the docs haven't been able to help me.
I want to re-use a custom SF Symbol from my app, so I've copied that from the main app's xcassets bundle to the one in the extension, and configured it for Template rendering.
The icon renders in the right click menu in Finder, the Finder preview pane and the Extensions section of System Settings, but all of them render with the wrong colour in dark mode. In light mode they look fine, but in dark mode I would expect a templated icon to be rendered in white, not black.
I've attached a variety of screenshots of the icons in the UI and how things are set up in Xcode (both for the symbol in the xcassets bundle, and the Info.plist)
I tried reading the docs, searching Google, searching GitHub and even asking the dreaded AI, but it seems like there's not really very much information available about doing icons for Finder extensions, especially ones using a custom SF Symbol, so I would love to know if anyone here has been able to solve this in the past!
Finder preview pane in light mode:
Finder preview pane in dark mode:
Finder quick action context menu:
System Settings extension preferences:
The custom symbol in my .xcassets bundle:
The finder extension's Info.plist:
Hello Shortcuts community!
I want to obtain a list of my notes, and well, update them, delete them if needed, and so on. These are simple actions that I can already do.
For this, I saw that shortcuts was pretty simple, and I could get what I wanted and pipe it through the terminal. However, even though I'm a programmer, there's a lot that I'm missing since I cannot pipe anything to the terminal.
I made a simple shortcut to give me some text, and I could obtain it via -shortcuts run "Example" | cat-, which well, gave me the output but with a %.
aaa**%**
Now, I guess this works, the important thing is for me to obtain something from shortcuts so that I can configure simple things like obtaining a note, a mail, run some javascript in the browser and so on while obtaining some output via the terminal.
So, I configured something like this:
While I do get a dictionary (only in the shortcuts app, not in the terminal) like:
{ "Title": "Some title" }
And actually a list of them, I don't have them in an array that I would have for my command. And for some reason I've only been able to obtain either the name or the body.
Now, I put them into a text with get text from Repeated results, but I don't think I have a valid Dictionary (JSON) array that I can use, since the terminal doesn't obtain nothing.
So far I've tried:
echo $(shortcuts run "Find Notes")
echo $(shortcuts run "Find Notes" --output-type public.utf8-plain-text -o -)
shortcuts run "Find Notes" | xargs
I wonder what am I missing. I'm not creating the array of dictionaries like I'd like, nor outputting it.
On the other hand, I have some AppleScripts that work, however, given that I cannot find munch information about the support status of AppleScript, I though to update to Shortcuts which is obtaining updates, and then I'm trying to do this simple example on shortcuts.
Thanks for taking a look!
Hello,
I recently installed the macOS 26 beta version on my MacBook Air M3, and I've encountered an issue where edited Word files are failing to save. I’ve tried restarting my laptop and checking for updates, but the problem persists.
Has anyone else experienced this issue? Is there a specific setting I might have missed or any troubleshooting steps you recommend?
Thank you for your assistance!
Topic:
App & System Services
SubTopic:
Hardware