I am encountering issues on my device running iOS 18 that fetching heart rate samples associated to a given workout is very slow. Like 10+ seconds slow. This is unacceptable and unexpected.
In producing a video to attach to a feedback, I also observed that Apple Health app displays incorrect information if a workout effort score is associated to a workout.
In this image, you can see the Health app bug:
Total Resting Energy != Estimated Workout Effort Score
Here is the same workout after I delete the workout effort score using the Apple Health app:
Can anyone else see if attempting to view 'heart rate' data within the workout summary in Apple Health is unbearably slow if that workout also has an effort score associated?
My steps:
Record workout (Apple Activity app on watchOS)
Associate effort score
View the workout on Apple Health (iOS)
Attempt to view it's heart rate samples
Observe very slow loading times
Observe the incorrect cell label and value and disappearance of resting energy cell data
Remove/disassociate the effort score from the workout by tapping the workout effort row, and swipe to delete the value.
Navigate back, navigate back, and then go into the workout detail again
At this time the UI fixes itself, but the loading of heart rate data is still super slow
FB15269657 - HealthKit: Sample query to fetch heart rate samples associated to a workout is taking over 10 seconds - computing 'time in heart rate zone'
FB15278790 - Health: Workout summary 'Total Resting Energy' label has value of 'Estimated Workout Effort Score' for a value, pushed view shows empty
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
After upgrading to iOS 18, my Core Data stack using NSPersistentCloudKitContainer in a shared App Group container stopped syncing correctly. The persistent store configuration, which previously worked in iOS 17, now experiences delayed or missing sync updates between devices. Then the app freezes and writes terminal the same error detail (which I provided) too many times.
The debug logs from the CloudKit mirroring delegate (NSCloudKitMirroringDelegate) show repetitive notifications but no updates in persistent history. Additionally, the persistent history tracking key appears unresponsive to local changes, causing transactions to fail in updating or syncing as expected.
Key setup details:
Core Data is set up within an App Group container using NSPersistentCloudKitContainer.
NSPersistentHistoryTrackingKey and NSPersistentStoreRemoteChangeNotificationPostOptionKey options are set to true.
Any insights into changes in iOS 18 Core Data or CloudKit handling with NSPersistentCloudKitContainer, especially around history tracking and sync delays, would be greatly appreciated. Thank you.
Error Detail
file:///private/var/mobile/Containers/Shared/AppGroup/BF95D309-EBE9-485E-B5CE-AA17097F7B60/[AppName]Database.sqlite
CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate managedObjectContextSaved:](3123): <NSCloudKitMirroringDelegate: 0x3032b4870>: Observed context save: <NSPersistentStoreCoordinator: 0x302694bd0> - <NSManagedObjectContext: 0x3036b1a00>
CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate remoteStoreDidChange:](3166): <NSCloudKitMirroringDelegate: 0x3032b4870>: Observed remote store notification: <NSPersistentStoreCoordinator: 0x302694bd0> - 090C4244-0101-4DEF-90D6-1260570F47A5 - <NSPersistentHistoryToken - {
"090C4244-0101-4DEF-90D6-1260570F47A5" = 9;
}> -
Persistence.swift
struct PersistenceController {
let container: NSPersistentCloudKitContainer
static let shared = PersistenceController()
static var preview: PersistenceController = {PersistenceController()}()
init() {
container = NSPersistentCloudKitContainer(name: "[AppName]")
// Configure CloudKit for the default container
if let url = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.[CompanyName].[AppName]") {
let storeURL = url.appendingPathComponent("[AppName]Database.sqlite")
let description = container.persistentStoreDescriptions.first
description?.url = storeURL
description?.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)
description?.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey)
container.persistentStoreDescriptions = [description].compactMap { $0 }
}
container.loadPersistentStores { (storeDescription, error) in
if let error = error as NSError? {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
}
container.viewContext.automaticallyMergesChangesFromParent = true
container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
}
}
Hello ApplePay Support,
I am integrating apple pay support on the following page but getting error. I have attached code files and video also about debug that code with different response print. Please check it and let me know where is issue.
ApplePay Page:
https://payment.bestgoodstudio.com/uk/pay/
JS Code:
$(document).ready(function() {
function setupApplePayButton() {
var applePayButton = $('#apple-pay-button');
if (applePayButton.length) {
applePayButton.on('click', function() {
initiateApplePayPayment();
});
}
}
async function initiateApplePayPayment() {
if (!window.ApplePaySession) {
alert('Apple Pay is not supported in this browser/environment.');
console.error('Apple Pay is not supported in this browser/environment.');
return;
}
var request = {
countryCode: 'GB',
currencyCode: 'EUR',
supportedNetworks: ['visa', 'masterCard', 'amex'],
merchantCapabilities: ['supports3DS', 'supportsEMV', 'supportsCredit', 'supportsDebit'],
total: {
label: 'Elitelab Pte Ltd',
amount: '2.50'
}
};
var session = new ApplePaySession(3, request);
session.onvalidatemerchant = async function(event) {
const validationURL = event.validationURL;
alert("Validation URL received: " + validationURL);
try {
const response = await fetch('https://payment.bestgoodstudio.com/uk/pay/apple_pay_validation.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ validationURL: validationURL })
});
const responseBody = await response.text(); // Get raw text to print whole response
alert("Validation Response (raw): " + responseBody); // Print raw response in alert
if (response.ok) {
const responseData = JSON.parse(responseBody); // Parse it if valid JSON
alert('Validation Response (parsed): ' + JSON.stringify(responseData));
console.log('Merchant Validation Data:', responseData);
if (session) {
session.completeMerchantValidation(responseData);
alert('Merchant validation completed.');
}
} else {
alert("Merchant Validation failed. HTTP Status: " + response.status);
session.abort(); // Abort session if validation fails
}
} catch (e) {
alert('Error during Merchant Validation: ' + e.message);
console.error('Merchant validation error:', e);
session.abort(); // Abort session on error
}
};
session.onpaymentauthorized = function(event) {
var payment = event.payment;
var paymentToken = payment.token.paymentData;
alert("Payment authorized. Payment Data: " + JSON.stringify(payment));
console.log('Payment Authorized:', payment);
processApplePayPayment(payment, function(success) {
if (success) {
session.completePayment(ApplePaySession.STATUS_SUCCESS);
alert('Payment completed successfully.');
} else {
session.completePayment(ApplePaySession.STATUS_FAILURE);
alert('Payment failed.');
}
});
};
session.oncancel = function(event) {
alert("Session canceled: " + JSON.stringify(event));
console.log("Session canceled:", event);
};
session.oncomplete = function(event) {
alert("Session complete: " + JSON.stringify(event));
console.log("Session complete:", event);
};
session.begin();
}
function processApplePayPayment(payment, callback) {
var postData = {
paymentData: payment.token.paymentData,
billingContact: payment.billingContact,
shippingContact: payment.shippingContact
};
$.ajax({
url: 'process_apple_pay.php',
method: 'POST',
data: JSON.stringify(postData),
contentType: 'application/json',
success: function(response) {
alert("Payment Processing Response: " + JSON.stringify(response));
console.log("Payment Processing Response:", response);
callback(response.success);
},
error: function(error) {
alert('Error processing payment: ' + JSON.stringify(error));
console.error('Error processing payment:', error);
callback(false);
}
});
}
setupApplePayButton();
});
PHP Code:
Topic:
App & System Services
SubTopic:
Apple Pay
On iPhone devices with dynamic islands (e.g. iPhone 15 Pro Max), the proximity sensor takes about 3 seconds to activate, is this normal?
The iPhone 13 responds almost instantly, but the iPhone 15 Pro Max seems to take a while.
class ProximitySensorManager {
// Shared instance for global access (optional)
static let shared = ProximitySensorManager()
// Proximity sensor activation flag
private(set) var isSensorEnabled: Bool = false
// Start observing proximity sensor changes
func enableProximitySensor(observer: Any) {
guard !isSensorEnabled else { return }
isSensorEnabled = true
UIDevice.current.isProximityMonitoringEnabled = true
NotificationCenter.default.addObserver(
observer,
selector: #selector(proximityStateChanged),
name: UIDevice.proximityStateDidChangeNotification,
object: nil
)
}
// Stop observing proximity sensor changes
func disableProximitySensor(observer: Any) {
guard isSensorEnabled else { return }
isSensorEnabled = false
UIDevice.current.isProximityMonitoringEnabled = false
NotificationCenter.default.removeObserver(
observer,
name: UIDevice.proximityStateDidChangeNotification,
object: nil
)
}
// Proximity sensor state change handler
@objc private func proximityStateChanged() {
if UIDevice.current.proximityState {
print("Proximity sensor detected close object")
// Additional functionality can be added here (e.g. lowering the screen brightness)
} else {
print("Proximity sensor detected no object")
}
}
deinit {
//disableProximitySensor() // Clean up observer on deinitialization
}
}
Hello,
I have an app where the users can connect their vehicles to an API and record trips and so on.
Currently I have one subscription, where the user can add as many vehicles as he wants. But now I want (need) to change this to one vehicle per subscription.
So if the user want to add two vehicles, he need to subscribe two times to the same product.
How can I handle this?
Thanks,
Arangoool
Topic:
App & System Services
SubTopic:
StoreKit
MKLaunchOptionsDirectionsModeDefault
MKLaunchOptionsDirectionsModeDriving
MKLaunchOptionsDirectionsModeWalking
MKLaunchOptionsDirectionsModeTransit
when I am using the mapkit navigation, I only see the 4 modes, but can not find the mode of bicycle, so how can I find the enum of using bicycle to navigate by bicycle ,than you!~
Xcode version is 16.
Topic:
App & System Services
SubTopic:
Maps & Location
Hello,
We have received three CONSUMPTION_REQUEST notifications for the same transactionId.
We sent a response to each CONSUMPTION_REQUEST notification to the API and received a 202 Accepted response.
Why do we receive multiple CONSUMPTION_REQUEST notifications even though we have sent a ConsumptionRequest to the Apple Store Server API? Do we need to respond to each CONSUMPTION_REQUEST for the same transactionId?
Thanks
We have an application that currently supports iOS 16, and in order to disable Streamlined Purchasing, the latest approved binary must include the necessary StoreKit APIs.
The StoreKit API includes the PurchaseIntent, which is available from iOS 16.4.
Our question is: Can we disable Streamlined Purchasing for our app? If yes, how will it work for devices running iOS versions earlier than 16.4?
I want to add a pkcanvasview image and change its position and size by dragging. And I want to draw a picture using a pencil on top.
The image must be able to change its position at any time, and a picture must be added on top.
If I add it to the subview of pkcanvasview, I cannot do what I want. How can I do this?
Our application streams live video with AVCaptureSession. When application is active and Airpods case is being opened at this time, popup message "Not Your Airpods..." is appeared over application and video session is suspended.
I can see that application receives notification UIApplicationWillResignActiveNotification, so application becomes inactive at this time.
Is there any ability to disable such pairing popup from Airpods or maybe intercept it inside our application? Because it affects our video streaming feature.
Thanks.
Topic:
App & System Services
SubTopic:
Notifications
Hello, I am currently developing an application using SensorKit to retrieve visit data. While the data retrieval works smoothly on one iPhone (iPhone 14, iOS 18.0.1), it fails on other devices, including:
iPhone 15 Pro Max with iOS 18.1 Beta
Another iPhone 14 with iOS 18.0
I’ve verified that the entitlements are configured properly, and the app has the necessary SensorKit visit permissions across all devices. Despite these steps, only one of the phones is able to retrieve the visit data correctly.
Is there any minimum hardware requirement or compatibility issue with certain models or configurations that I should be aware of for using SensorKit visits?
Any guidance or insight would be greatly appreciated!
Thank you.
uni.getProvider({
service: 'payment',
success: (res) => {
const iapChannel = res.providers.find((channel) => {
return (channel.id === 'appleiap')
})
if (iapChannel) {
let ids = ['1234567890', '1234567892'];
iapChannel.requestOrder(ids, (
orderList) => {
console.log("----- order -----", orderList);
}, (e) => {
console.log('--- failed ---' , e);
});
uni.requestPayment({
provider: 'appleiap',
orderInfo: {
productid: that.productid,
manualFinishTransaction: true,
username: ress.data.orderId
},
success: (e) => {
that.isPayLoadding = false
},
fail: (e) => {
that.isPayLoadding = false
}
})
}
}
});
Does anyone else have this issue?
We have been having this issue for years since we start using Apple Pay on the Web.
I have checked TN3173 Your domain does not automatically re-verify section, we should meet all requirements.
I have emailed applepaymerchantsupport at apple.com several times (Case-ID: 7663879), either saying "still checking", or no response at all.
Our certificate for the Merchant Domains is maintained in Cloudflare, signed with Google Trust Service, rotate every 3 months.
I've noticed delays with the Live Caller ID Lookup feature, taking around 3 to 6 seconds to complete, even on repeated lookups. This seems odd since there's no server activity during these repeats, suggesting the information might be coming from a cache. Most of the time, it’s fast, but there are cases when it's unexpectedly slow, and I haven’t quite figured out the pattern yet. Is anyone else seeing this issue?
FB number FB15372765 - with sysdiagnose and video demonstrating the delay.
I am working on the integration of subscriptions in my OSX application. The subscription flow works perfectly but after the purchase it is not creating _MASReceipt folder in Contents folder of application so I cannot send the receipt to apple to verify this purchase. when I checked the logs it showing below error. Anyone who is familiar to this issue please help.
Error writing receipt (13401 bytes) using privileged service to /private/var/folders/xw/yd038cts3b94qmtvlxzb1sy80000gp/T/AppTranslocation/9B8BB321-1C16-4F41-93EA-E27675791E79/d/test.app
Error Domain=NSCocoaErrorDomain Code=642 "You can’t save the file “_MASReceipt” because the volume “9B8BB321-1C16-4F41-93EA-E27675791E79” is read only." UserInfo={NSFileOriginalItemLocationKey=file:///private/var/folders/xw/yd038cts3b94qmtvlxzb1sy80000gp/T/AppTranslocation/9B8BB321-1C16-4F41-93EA-E27675791E79/d/Advanced%20Uninstall%20Manager.app/Contents/_MASReceipt, NSURL=file:///private/var/folders/xw/yd038cts3b94qmtvlxzb1sy80000gp/T/AppTranslocation/9B8BB321-1C16-4F41-93EA-E27675791E79/d/abc.app/Contents/_MASReceipt, NSFileNewItemLocationKey=file:///System/Library/Caches/com.apple.appstored/abc.app/_MASReceipt/, NSUnderlyingError=0x7fdc618ded90 {Error Domain=NSCocoaErrorDomain Code=642 "You can’t save the file “_MASReceipt
Im update my app to new version and the widget that use IntentConfiguration created in old version not working and still lay on homescreen. Is there any way to keep old widget working fine?
in ios 18, we can custom two bottom button on Lock Screen, in past, they are Flash and Camera.
So I want my app's function could be display in here, and I custom it, and will show a Controls List, But I can not found my app's icon.
How to make a myself Control item and add it to Control List?
any guideline or tutorials are welcome :D
Hello,
I am facing with misunderstanding how to read usb device properties correctly.
The notification 'kIOTerminatedNotification' is delivered after an IOService has been terminated. Can I use IORegistryEntryCreateCFProperties() to get properties of terminated device?
I am asking because I/O Registry is a dynamic database that captures the connections of all driver and nub objects currently active. Howerver, can we say that terminated device is still active?
If IORegistryEntryCreateCFProperties() can not be used, are there any other way? (e.g. using Device Interface)
Thank you in advance!
Hello everyone,
I've built a @CurrentValue property wrapper that mimics the behavior of @Published, allowing a property to publish values on "did set". I've also created my own assign(to:) implementation that works with @CurrentValue properties, allowing values to be assigned from a publisher to a @CurrentValue property.
However, I'm running into an issue. When I use this property wrapper with two classes and the source class (providing the publisher) is not stored as a property, the subscription is deallocated, and values are no longer forwarded.
Here's the property wrapper code:
@propertyWrapper
public struct CurrentValue<Value> {
/// A publisher for properties marked with the `@CurrentValue` attribute.
public struct Publisher: Combine.Publisher {
public typealias Output = Value
public typealias Failure = Never
/// A subscription that forwards the values from the CurrentValueSubject to the downstream subscriber
private class CurrentValueSubscription<S>: Subscription where S: Subscriber, S.Input == Output, S.Failure == Failure {
private var subscriber: S?
private var currentValueSubject: CurrentValueSubject<S.Input, S.Failure>?
private var cancellable: AnyCancellable?
init(subscriber: S, publisher: CurrentValue<Value>.Publisher) {
self.subscriber = subscriber
self.currentValueSubject = publisher.subject
}
func request(_ demand: Subscribers.Demand) {
var demand = demand
cancellable = currentValueSubject?.sink { [weak self] value in
// We'll continue to emit new values as long as there's demand
if let subscriber = self?.subscriber, demand > 0 {
demand -= 1
demand += subscriber.receive(value)
} else {
// If we have no demand, we'll cancel our subscription:
self?.subscriber?.receive(completion: .finished)
self?.cancel()
}
}
}
func cancel() {
cancellable = nil
subscriber = nil
currentValueSubject = nil
}
}
/// A subscription store that holds a reference to all the assign subscribers so we can cancel them when self is deallocated
fileprivate final class AssignSubscriptionStore {
fileprivate var cancellables: Set<AnyCancellable> = []
}
fileprivate let subject: CurrentValueSubject<Value, Never>
fileprivate let assignSubscriptionStore: AssignSubscriptionStore = .init()
fileprivate var value: Value {
get {
subject.value
}
nonmutating set {
subject.value = newValue
}
}
init(_ initialValue: Output) {
self.subject = .init(initialValue)
}
public func receive<S>(subscriber: S) where S: Subscriber, Failure == S.Failure, Output == S.Input {
let subscription = CurrentValueSubscription(subscriber: subscriber, publisher: self)
subscriber.receive(subscription: subscription)
}
}
public var wrappedValue: Value {
get { publisher.value }
nonmutating set { publisher.value = newValue }
}
public var projectedValue: Publisher {
get {
publisher
}
mutating set {
publisher = newValue
}
}
private var publisher: Publisher
public init(wrappedValue: Value) {
publisher = .init(wrappedValue)
}
}
/// A subscriber that receives values from an upstream publisher and assigns them to a downstream CurrentValue property.
private final class AssignSubscriber<Input>: Subscriber, Cancellable {
typealias Failure = Never
private var receivingSubject: CurrentValueSubject<Input, Never>?
private weak var assignSubscriberStore: CurrentValue<Input>.Publisher.AssignSubscriptionStore?
init(currentValue: CurrentValue<Input>.Publisher) {
self.receivingSubject = currentValue.subject
self.assignSubscriberStore = currentValue.assignSubscriptionStore
}
func receive(subscription: Subscription) {
// Hold a reference to the subscription in the downstream publisher
// so when it deallocates, the susbcription is automatically cancelled
assignSubscriberStore?.cancellables.insert(AnyCancellable(subscription))
subscription.request(.unlimited)
}
func receive(_ input: Input) -> Subscribers.Demand {
receivingSubject?.value = input
return .none
}
func receive(completion: Subscribers.Completion<Never>) {
// Nothing to do here
}
public func cancel() {
receivingSubject = nil
assignSubscriberStore = nil
}
}
public extension Publisher where Self.Failure == Never {
/// Assigns the output of the upstream publisher to a downstream CurrentValue property
/// - Parameter currentValue: The CurrentValue property to assign the values to
func assign(to currentValue: inout CurrentValue<Self.Output>.Publisher) {
let subscriber = AssignSubscriber(currentValue: currentValue)
self.subscribe(subscriber)
}
}
Here’s an example demonstrating the issue, where two classes are used: Source, which owns the @CurrentValue property, and Forwarder1, which subscribes to updates from Source:
final class Source {
@CurrentValue public private(set) var value: Int = 1
func update(value: Int) {
self.value = value
}
}
final class Forwarder1 {
@CurrentValue public private(set) var value: Int
init(source: Source) {
self.value = source.value
source.$value.dropFirst().assign(to: &$value)
// The source is not stored as a property, so the subscription deallocates
}
func update(value: Int) {
self.value = value
}
}
With this setup, if source isn’t retained as a property in Forwarder1, the subscription is deallocated prematurely, and value in Forwarder1 stops receiving updates from Source.
However, this doesn’t happen with @Published properties in Combine. Even if source isn’t retained, @Published subscriptions seem to stay active, propagating values as expected.
My Questions:
What does Combine do internally with @Published properties that prevents the subscription from being deallocated prematurely, even if the publisher source isn’t retained as a property?
Is there a recommended approach to address this in my custom property wrapper to achieve similar behavior, ensuring the subscription isn’t lost?
Any insights into Combine’s internals or suggestions on how to resolve this would be greatly appreciated. Thank you!
Dear Apple engineers,
Is it possible to make a fileprovider cloud volume mount path independent of the user's home folder in order to have constant path across desktop clients when files are referenced / placed by applications like Adobe Creative Cloud ?
Ideally mount or link the fileprovider cloud volume under /Volumes
Thanks,