I’m attempting to make an app that uses Disk Arbitration to intercept a disk mount (by creating and returning a dissenter in the appropriate callback) and then mount the disk with certain options (specifically, read-only, nobrowse, or both, depending on user options). For example:
DADiskMountWithArguments(disk, nil, DADiskMountOptions(kDADiskMountOptionDefault), nil, nil, kReadOnly)
…where kReadOnly is a pointer to an array only containing a “rdonly” CFString.
While DADiskMountWithArguments seems to be usable in a sandboxed app for disk images, it doesn’t work when the disk is an external disk (e.g. connected via USB). I see lines like this in Console.app when this happens:
Sandbox denied authorizing right 'system.volume.external.mount' by client '/path/to/exe' [17934] (engine 580)
I’ve identified two workarounds that allow this to work in a sandbox, but both have their own problems:
If a LaunchDaemon (even a sandboxed one, which is required for registration with SMAppService.daemon from the sandboxed app) does the call to DADiskMountWithArguments, it will succeed. But App Store policies don’t allow escalation to root.
If I use the undocumented entitlement com.apple.security.temporary-exception.sbpl with a value of (allow authorization-right-obtain (right-name "system.volume.external.mount")), the mount works without escalation to root. But I understand that App Review is likely to reject the use of this entitlement, and that this entitlement isn't supported to begin with.
Specifically, these are the behaviors I see on macOS Sequoia 15.3.1 and Xcode 16.2.
Since I would like to try to publish this app on the App Store, neither of these seem like acceptable solutions.
I don’t see why this should be restricted if the sandboxed app is not declaring a special path (i.e. the path in DADiskMountWithArguments is set to nil) and still does not have access to the mounted filesystem - am I missing something/is there a way to accomplish this?
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.
Post
Replies
Boosts
Views
Activity
I am unable to get an iPhone Xr (iOS 18) or iPhone 15 to interact with Texas Instruments RF430CL330H NFC tag. This is an ISO 14443B-compliant tag supporting NDEF. It is NFC Tag Type 4.
A Samsung S23 with Android 14 and NFC Tools v8.11 reads and writes NDEF data with this tag as expected. The iPhones with NFC Tools v2.31 do not.
For the following comparison the NDEF memory is written with a pre-loaded text data record.
NFC Tools on Android reports the following:
Tag Type: ISO 14443-4
Technologies Available: IsoDep, NfcB, Ndef
Serial Number:
Format: NFC Forum Type 4
Text Record 1: UTF-8 (en) Hello World!
NFC Tools on iOS (iPhones) reports the following:
Tag Type: ISO 7816
Technologies Available: Unknown
Serial Number:
Format: <no entry, not listed>
Text Record 1: <no entry, not listed>
Error response: "This nfc tag is not supported"
Attempting to write a text message with NFC Tools on the iPhones returns "An error occurred during writing process"
Other NDEF records (URL and Search) written into memory with the Samsung NFC Tools are also not readable with the iPhones.
The iPhones are able to obtain the tag type and serial number of the chip, so there is some limited interaction.
Is there a compatibility issue with the Type B tag, or perhaps something else?
Hello,
My app has had CloudKit enabled for a while, but it's not working. I get the error "Invalid bundle ID for container".
Configure CloudKit in your project from TN3164 suggests changing to a new container. I tried changing to a new container, but this leads to data loss.
The article recommends:
"If your CloudKit container is already used in the production environment and switching to a new container leads to data loss, consider filing a feedback report with the following information to request manually associating your CloudKit container with your app ID."
Where can I request this manual association? Is there anything else I can do?
Thank you for your time and assistance. I’d appreciate a prompt resolution, as this issue is blocking our update. Looking forward to guidance.
I am trying to commission an ESP32-H2 Matter device using the chip-tool. It's running the Light Switch sample. I can commissioning it using the iOS Home App, so I know the code on it's working okay.
I would like to understand more about the Fabric process, so I'd like to use the Home Pod powered Thread network rather than setting up an instance of Open Thread Border Router.
I have created a simple iOS app and can fetch the activeOperationalDataSet from the Preferred network using
func obtainPreferredNetworkCredentials() async -> (Void) {
let client = THClient()
let bIsPreferredAvailable = await client.isPreferredAvailable()
if bIsPreferredAvailable == true
{
var credential: THCredentials?
do {
credential = try await client.preferredCredentials()
if let dataset = credential?.activeOperationalDataSet {
print(dataset.hexDescription)
}
} catch {
print("Failed to get the credentials")
}
}
}
The hexDescription comes from this extension
extension Data {
var hexDescription: String {
return reduce("") {$0 + String(format: "%02x", $1)}
}
}
I am decoding the Data and displaying it as a hex string. It looks something like this:
0e080000000000000000000300001935060004001fffc002089f651677026f48070708fd9f65167702000ee90914b5d1097de9bb0818dc94690c0402a0f7f8
However, when I attempt to commission the device, it fails during ThreadSetup. Googling the issue says most likely the Operational Dataset is wrong in some way.
Before I spend too much time on this, I want to make sure I'm doing the right thing in terms of getting the Operational Dataset to use with the chip-tool.
Any help is appreciated!
I’m trying to associate heart rate (HR) data with a mindfulness session (HKCategoryTypeIdentifier.mindfulSession) in HealthKit, but I can’t find any documentation on how to do this.
I’ve seen third-party apps (like Medito) successfully log HR within Mindful Minutes, even when the session takes place on an iPhone (not an Apple Watch). However, when I try saving HR in the metadata, it does not appear in the Health app's Mindful Minutes section.
Code snippet:
func logMindfulnessSession(start: Bool, heartRate: Double? = nil) {
let mindfulType = HKCategoryType.categoryType(forIdentifier: .mindfulSession)!
let now = Date()
let endTime = now.addingTimeInterval(Double(selectedDuration))
var metadata: [String: Any]? = nil
if let hr = heartRate {
let heartRateUnit = HKUnit.count().unitDivided(by: HKUnit.minute())
let hrQuantity = HKQuantity(unit: heartRateUnit, doubleValue: hr)
metadata = ["heartRate": hrQuantity] // ❓ Is there a correct key for HR?
}
let sample = HKCategorySample(
type: mindfulType,
value: 0,
start: now,
end: endTime,
metadata: metadata
)
healthStore.save(sample) { success, error in
if let error = error {
print("HealthKit session save error: \(error.localizedDescription)")
} else {
print("Mindfulness session saved successfully.")
if let hr = heartRate {
print("Saved with HR: \(hr) BPM")
}
}
}
}
Questions:
What is the correct metadata key for associating heart rate with a mindful session?
Does HealthKit require a specific format (e.g., HKQuantitySample) for HR?
0 Are there additional permissions needed to allow HR to appear in Mindful Minutes?
Does HR need to be stored separately in HKQuantityTypeIdentifier.heartRate, and if so, how do third-party apps ensure it appears in the same entry as the mindful session?
thank you!
I want to monitor again from the bellow function of DeviceActivityMonitorExtension. I have the function of startMonitoring like this.
override func eventDidReachThreshold(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) {
super.eventDidReachThreshold(event, activity: activity)
startMonitoring()
}
public func startMonitoring() {
let startTime = DateComponents(hour: 0, minute: 0, second: 0)
let endTime = DateComponents(hour: 23, minute: 59, second: 59)//DateComponents(hour: 11, minute: 0, second: 0)//
let schedule = DeviceActivitySchedule(
intervalStart: startTime,//DateComponents(hour: 0, minute: 0, second: 0),
intervalEnd: endTime,
repeats: true
//warningTime: DateComponents(minute:1)
)
let selection: FamilyActivitySelection = savedSelection() ?? FamilyActivitySelection()
let center = DeviceActivityCenter()
let selections = self.savedSelection() ?? FamilyActivitySelection()
let applications = selections.applicationTokens
let categories = selections.categoryTokens
let webCategories = selections.webDomainTokens
let store = ManagedSettingsStore()
store.shield.applicationCategories = ShieldSettings.ActivityCategoryPolicy.specific(categories, except: Set())
store.shield.applications = applications
store.shield.webDomains = webCategories
let scheduleHard = DeviceActivitySchedule(
intervalStart: startTime,//DateComponents(hour: 0, minute: 0, second: 0),
intervalEnd: endTime,
repeats: true
//warningTime: DateComponents(minute:1)
)
let event = DeviceActivityEvent(
applications: selection.applicationTokens,
categories: selection.categoryTokens,
webDomains: selection.webDomainTokens,
threshold: DateComponents(minute: 0)//timeLimitToUseApp i.e for 15 mins
)
do {
try center.startMonitoring( .weekend,
during: scheduleHard,
events: [
.weekend: event,
]
)
print("ScreenTime Monitoring Started")
} catch let error {
print(error.localizedDescription)
}
}
Please provide us with a solution about starting monitoring from DeviceActivityMonitoringExtension's eventDidReachThreshold function or if there is any other way.
where can we find documentation on the following fields included in payloads? They're not listed alongside the other fields in the documentation linked below:
https://developer.apple.com/documentation/weatherkitrestapi/hourweatherconditions
precipitationIntensity
snowfallAmount
Or if we can get the data type, unit used, and description here that would be great
regarding forecastHourly payloads, what is the timezone of forecastStart?
just want to confirm what we are seeing in the payloads
is there documentation where we can find details for historical parameters / limitations - so far i've found that the days limit on single API calls days limit is 7. Any other similar specs would be good to have
A customer of mine signed up for a free trial. I got a apple server notification with notification type DID_RENEW. What does that mean? Does that mean that they will be charged the subscription price now?
Hello everyone,
I need help updating business information on Apple Maps for locations in Ukraine. Unfortunately, the usual methods, like "Report an Issue" in the Maps app or using Apple Business Connect, don’t seem to be working properly for Ukrainian businesses.
Many locations have outdated or missing details, which is frustrating for both business owners and customers. Given the current situation, keeping information accurate is more important than ever.
Has anyone successfully updated business listings in Ukraine recently? If so, could you share the process or any contacts that might help? Any advice would be greatly appreciated!
Thanks in advance!
Hello,
I’m experiencing an issue with my iOS app that uses CoreBluetooth in combination with beacon monitoring. My app is designed to wake via beacon region monitoring and then start scanning for a specific BLE peripheral (with specific service UUIDs). When the device screen is bright (i.e., the device is unlocked, or locked but the screen is active/bright), everything works perfectly—the connection is established and maintained without any issues in both: foreground and background.
However, when the device is left alone for a while and the lock-screen dims (sleeps), the app continues to run in the background and range the beacon (I can confirm this via realtime console logs), but the connection attempt fails. Here’s what I observe:
The central manager’s delegate method didConnect is called, indicating that the peripheral was connected.
Almost immediately afterward, didDisconnect is triggered with the error message:
"The specified device has disconnected from us.".
The interesting part is (I repeatedly see this error in the console, because the app repeatedly tries to connect to peripheral until a success), when I touch the lockscreen (not unlock, but just touch, which makes the screen to light up brighter), the connection is being established without any further issues!
I have the necessary background modes enabled in the app’s capabilities (e.g., bluetooth-central, location-always-mode, etc..). My expectation was that, thanks to beacon monitoring, the app would be awakened when needed, and scanning/connection would work reliably in the background regardless of whether the device is active or dimmed.
My questions are:
Why might the connection fail with this error when the device is locked/dimmed?
Is this behavior expected due to iOS power management policies even if the app remains active in the background?
Is there a way to ensure a reliable connection in such cases?
Any insights, workarounds, or suggestions would be greatly appreciated. Thank you in advance!
Apple Pay processed a transaction but the account has insufficient funds. Later the transaction is declined. Is it expected from Apple Pay? Does Apple Pay throws an error if the account has insufficent funds- iOS Swift ?
Does anyone know the code to handle this scenario in Swift iOS?
All the threads only contain system calls. The crashed thread only contains a single call to my app's code which is main.swift:13.
What could cause such a crash?
crash.crash
When our content filter is deployed, some customers report issues which show that the content filter activation was performed but the filter is showing the state [activated waiting for user].
This typically happens if the customer isn't deploying a profile to pre-authorise the system extension.
The customers report that there was no popup shown for them to allow the filter to complete activation.
Once the filter is in this state, there doesn't seem to be a way to clear it without resorting to disabling SIP.
Attempting a deactivation does not work, the filter remains in the same state.
Is there a way we can we resolve this "stuck" state when it happens without disabling SIP?
I'm simply trying to use a proxy to route a http request in Swift. I've tried using a URLSession Delegate but that results in the same issue with the iOS menu.
proxy format: host:port:username:password
When I run the code below I am prompted with a menu to add credentials for the proxy. I closed this menu inside my app and tried the function below again and it worked without giving me the menu a second time. However even though the function works without throwing any errors, it does NOT use the proxies to route the request.
I've spent days on this and the only solution I found was using a NWConnection but this is super low level and now I need a shared session to manage cookies. If you want to see the NWConnection solution I made its here
func averageProxyGroupSpeed(proxies: [String], completion: @escaping (Int, String) -> Void) {
let numProxies = proxies.count
if numProxies == 0 {
completion(0, "No proxies")
return
}
var totalTime: Int64 = 0
var successCount = 0
let group = DispatchGroup()
let queue = DispatchQueue(label: "proxyQueue", attributes: .concurrent)
let lock = NSLock()
let shuffledProxies = proxies.shuffled()
let selectedProxies = Array(shuffledProxies.prefix(25))
for proxy in selectedProxies {
group.enter()
queue.async {
let proxyDetails = proxy.split(separator: ":").map(String.init)
guard proxyDetails.count == 4,
let port = Int(proxyDetails[1]),
let url = URL(string: "http://httpbin.org/get") else {
completion(0, "Invalid proxy format")
group.leave()
return
}
var request = URLRequest(url: url)
request.timeoutInterval = 15
let configuration = URLSessionConfiguration.default
configuration.connectionProxyDictionary = [
AnyHashable("HTTPEnable"): true,
AnyHashable("HTTPProxy"): proxyDetails[0],
AnyHashable("HTTPPort"): port,
AnyHashable("HTTPSEnable"): false,
AnyHashable("HTTPUser"): proxyDetails[2],
AnyHashable("HTTPPassword"): proxyDetails[3]
]
let session = URLSession(configuration: configuration)
let start = Date()
let task = session.dataTask(with: request) { _, _, error in
defer { group.leave() }
if let error = error {
print("Error: \(error.localizedDescription)")
} else {
let duration = Date().timeIntervalSince(start) * 1000
lock.lock()
totalTime += Int64(duration)
successCount += 1
lock.unlock()
}
}
task.resume()
}
}
group.notify(queue: DispatchQueue.main) {
if successCount == 0 {
completion(0, "Proxies Failed")
} else {
let averageTime = Int(Double(totalTime) / Double(successCount))
completion(averageTime, "")
}
}
}
Delegate example
class ProxySessionDelegate: NSObject, URLSessionDelegate {
let username: String
let password: String
init(username: String, password: String) {
self.username = username
self.password = password
}
func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodHTTPBasic {
let credential = URLCredential(user: self.username, password: self.password, persistence: .forSession)
completionHandler(.useCredential, credential)
} else {
completionHandler(.performDefaultHandling, nil)
}
}
}
Hi all, i am trying to implement File Provider Extension. I was able to enumerate remote storage directories to local via 'enumerateItems' function of NSFileProviderEnumerator.
I can apply remote storage changes like newly created files/folders, move, rename and delete operations and successfully apply them to local with 'NSFileProviderChangeObserver' class 'didUpdate' and 'didDeleteItems' functions.
However when file content is updated on remote server;
If file content is not fetched(file is Dataless), i can not apply this change to local. When i call 'NSFileProviderChangeObserver' class 'didUpdate' function for changed file, only DateModified attribute is updated on finder, file size is not changed to new size.
If file content has been fetched, When i call 'NSFileProviderChangeObserver' class 'didUpdate' function nothing is changed, file content stay depreciated
Any suggestion how to fix it?
While troubleshooting Tap to Pay on iPhone, it is essential that the developer is able to collect logs on their device and check those logs for error messages. This is also essential when reporting issues to Apple. To gather the required data for your own debugging as well as reporting issues, please perform the following steps on the test device:
Install the Tap to Pay profile on your iPhone.
Reproduce the issue and make a note of the timestamp when the issue occurred, while optionally capturing screenshots or video.
Gather a sysdiagnose on the same iPhone.
Create a Feedback Assistant report with the following information:
The bundle ID
The serial number of the device.
For iOS, open Settings > General > About (tap and hold to copy).
The SEID (Secure Element Identifier) of the device, represented as a HEX encoded string.
For iOS, open Settings > General > About > SEID (tap and hold to copy).
The sysdiagnose gathered after reproducing the issue.
The timestamp (including timezone) of when the issue was reproduced.
Screenshots or videos of errors and unexpected behaviors (optional).
Submitting Your Feedback
After your submission to Feedback Assistant is complete, please respond to your post with the Feedback ID. Once received, I can begin my investigation and determine if this issue is caused by an error within your app, a configuration issue within your developer account, app configuration, or an underlying system bug.
Cheers,
Paris X Pinkney | WWDR | DTS Engineer
The system calendar when showing a calendar event shows a relative timestamp on the notification versus all other apps which have a timestamp of when the notification was sent.
Is there a way to set the timestamp to be relative? I am currently working on a calendar app and we should be able to use the same system that apple uses for its own calendar.
Post about this on stack overflow from someone else a few years ago
I was using os_log in my code and in header of oslog, it has been mentioned that there is physical cap of 1024 bytes per log line for dynamic content. So I was looking for a work around but before that I am not able see the truncation when I tried creating this issue.
let baseString = String(repeating: "a", count: 1020)
let criticalMarker = "LAST_5_BYTES"
let testString = baseString + criticalMarker // 1020 + 12 = 1032 bytes
os_log("LONG_STRING: %@", testString)
I used this as a sample code to check the truncation but in Xcode debugger it logs all the 1020 bytes and the last 12 bytes as well. I even checked the console and there also it was logging all the bytes.
Can anyone help me with this as to what I am missing here?