I found that the enumerateItems function is only called when a directory is opened for the first time. If the same directory is opened in the future, enumerateItems will not be called again. Can you set or actively trigger the call to the enumerateItems function
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
I'm developing a watchOS nap app that detects when the user falls asleep by monitoring heart rate changes.
== Technical Implementation ==
HKWorkoutSession (.mindAndBody) for background execution
HKAnchoredObjectQuery for real-time heart rate data
CoreMotion for movement detection
== Battery Considerations ==
Heart rate monitoring ONLY active when user explicitly starts a session
Monitoring continues until user is awakened OR 60-minute limit is reached
If no sleep detected within 60 minutes, session auto-ends
(user may have abandoned or forgotten to stop)
App displays clear UI indicating monitoring is active
Typical session: 15-30 minutes, keeping battery usage minimal
== The Problem ==
HKWorkoutSession affects Activity Rings during the session. Users receive
"Exercise goal reached" notifications while resting — confusing.
== What I've Tried ==
Not using HKLiveWorkoutBuilder → Activity Rings still affected
Using builder but not calling finishWorkout()
(per https://developer.apple.com/forums/thread/780220)
→ Activity Rings still affected
WKExtendedRuntimeSession (self-care type)
(per https://developer.apple.com/forums/thread/721077)
→ Only ~10 min runtime, need up to 60 min
HKObserverQuery + enableBackgroundDelivery
(per https://developer.apple.com/forums/thread/779101)
→ ~4 updates/hour, too slow for real-time detection
Audio background session for continuous processing
(suggested in https://developer.apple.com/forums/thread/130287)
→ Concerned about App Store rejection for non-audio app;
if official approves this technical route, I can implement in this direction
Some online resources mention "Health Monitoring Entitlement" from WWDC 2019
Session 251, but I could not find any official documentation for this entitlement.
Apple Developer Support also confirmed they cannot locate it?
== My Question ==
Is there any supported way to:
Monitor heart rate in background for up to 60 minutes
WITHOUT affecting Activity Rings or creating workout records?
If this requires a special entitlement or API access, please advise on
the application process. Or allow me to submit a code-level support request.
Any guidance would be greatly appreciated. Thank you!
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
Entitlements
Health and Fitness
HealthKit
I've heard that when a Mac app implements their version of the Standard AppleEvent suite, the developer can copy "CocoaStandard.sdef" and trim out whatever they don't need. What are the constraints on this trimming?
I guess that we could remove commands wholesale, but can we remove sub-parts of a command? Can we change an enumeration? A record type?
I´m tring to integrate InApp push provisioning but when I send the information from the issuer to SDK to add my debit card to wallet I saw this error: PKPassKitErrorDomain Code 2 error
Looking in the forum I found how to see part of the logs to get more detail on the error and I found:
POST https://pr-pod9-smp-device.apple.com:443/broker/v4/devices/04131B65D01590022288082867404947F3CCA674C3D41F3C/cards/683986c983984251b9aecfc8ff51d88a/enable
'Error Domain=PKPaymentWebServiceErrorDomain Code=0 "Error inesperado." UserInfo={PKErrorHTTPResponseStatusCodeKey=500, NSLocalizedDescription=Error inesperado.
Topic:
App & System Services
SubTopic:
Wallet
Tags:
Wallet
Entitlements
In-App Purchase
Provisioning Profiles
AgeRangeService is the burning topic right now. Needless to say, Everything is so unclear.
We got our app finally into the TestFlight for QA and the product to test. only to find out that AgeAssurance for sandbox testing does not work.
There is no document confirming or denying whether and when age assurance for the App with the release configuration in test flight would work.
There isn't any guidance from Apple on whether an app that sells physical goods, such as an e-commerce app, can continue doing business as usual.
Also, there is no clarity that the Age assurance options are off, 13, unverified, 13 verified, and so on.
How those should be used.
Hi!
I have over 800 days strike in closing my move circle. However oerfect month badge is not popping up for November, we have now mid of Dec and still no update.
I updated iOS to 26, did multiple resets and hard resets and still no badge. I checked many forums and post but any of given tips is working in my case.
i know it sounds funny, but it’s frustrating that I’m not getting this little gold medal to keep me motivated 😅
does anyone know how to deal with it? Is it common issue?
When updating an existing advanced app clip experience, the change doesn't actually apply. It shows the correct image in the UI, but when you use the app clip it shows the old image. Looking into it more, the status has "UPDATE_SUBMITTED". Seems related to this issue (https://developer.apple.com/forums/thread/810544) and this issue (https://developer.apple.com/forums/thread/810351).
We recently released an update to our app to prepare for TX SB2420.
Almost immediately on release, we started getting crash reports of crashes when calling isEligibleForAgeFeatures.
Crashed: com.apple.root.user-initiated-qos.cooperative
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000004
Is it possible that these are beta users that have IOS 26.2 RC or is there a bug in the release version of IOS 26.2?
Note: The crash reports are coming from Crashlytics so we are not getting OS build identifiers other than version "26.2"
I have a total of 100 asset packs associated with my app but I have archived 5 of them. Unfortunately I am now unable to upload any more asset packs (the reported error is "backgroundAsset limit reached -- This app has already reached the maximum number of active backgroundAssets. Maximum allowed is 100.") I assumed that archiving asset packs would make them inactive (and thus not count against the limit). This seems to not be the case and I'm not sure how I can upload new asset packs.
We have a simple function that retrieves users list via CSIdentityQueryCreate() and CSIdentityQueryExecute().
However, sometimes we get crashes in "com.apple.opendirectory.odxpc.xpc" queue and address sanitizer reports that something inside opendirectory related framework tries to access data that was released:
==327==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000166890010 at pc 0x000109b51f98 bp 0x00016b6f58d0 sp 0x00016b6f5070
READ of size 5 at 0x000166890010 thread T242
#0 0x000109b51f94 in memcpy+0x294 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x85f94)
#1 0x000191c08e64 in __CFStringCreateImmutableFunnel3+0x4f8 (CoreFoundation:arm64e+0x2e64)
#2 0x000191d2494c in ____CFBinaryPlistCreateObjectFiltered_block_invoke+0xa4 (CoreFoundation:arm64e+0x11e94c)
#3 0x000191c39fc8 in __CFBinaryPlistCreateObjectFiltered+0x698 (CoreFoundation:arm64e+0x33fc8)
#4 0x000191c3aff0 in __CFBinaryPlistCreateObjectFiltered+0x16c0 (CoreFoundation:arm64e+0x34ff0)
#5 0x000191c20b98 in __CFTryParseBinaryPlist+0xe8 (CoreFoundation:arm64e+0x1ab98)
#6 0x000191d11e14 in _CFPropertyListCreateWithData+0x98 (CoreFoundation:arm64e+0x10be14)
#7 0x000191c20a2c in CFPropertyListCreateWithData+0x38 (CoreFoundation:arm64e+0x1aa2c)
#8 0x00019b3a49d0 in ___odxpc_create_connection_block_invoke+0x104 (CFOpenDirectory:arm64e+0x29d0)
#9 0x00019189e82c in _xpc_connection_call_event_handler+0x6c (libxpc.dylib:arm64e+0xe82c)
#10 0x00019189d128 in _xpc_connection_mach_event+0x4a8 (libxpc.dylib:arm64e+0xd128)
#11 0x0001919f98a0 in _dispatch_client_callout4+0xc (libdispatch.dylib:arm64e+0x1b8a0)
#12 0x0001919fc10c in _dispatch_mach_msg_invoke+0x1cc (libdispatch.dylib:arm64e+0x1e10c)
#13 0x0001919e81b4 in _dispatch_lane_serial_drain+0x148 (libdispatch.dylib:arm64e+0xa1b4)
#14 0x0001919fce70 in _dispatch_mach_invoke+0x1d4 (libdispatch.dylib:arm64e+0x1ee70)
#15 0x0001919e81b4 in _dispatch_lane_serial_drain+0x148 (libdispatch.dylib:arm64e+0xa1b4)
#16 0x0001919e8e28 in _dispatch_lane_invoke+0x180 (libdispatch.dylib:arm64e+0xae28)
#17 0x0001919f3260 in _dispatch_root_queue_drain_deferred_wlh+0x120 (libdispatch.dylib:arm64e+0x15260)
#18 0x0001919f2ae4 in _dispatch_workloop_worker_thread+0x218 (libdispatch.dylib:arm64e+0x14ae4)
#19 0x000191b93e1c in _pthread_wqthread+0x120 (libsystem_pthread.dylib:arm64e+0x2e1c)
#20 0x000191b92b70 in start_wqthread+0x4 (libsystem_pthread.dylib:arm64e+0x1b70)
0x000166890010 is located 10946 bytes after 789838-byte region [0x0001667cc800,0x00016688d54e)
freed by thread T240 here:
#0 0x000109b09480 in free+0x7c (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3d480)
#1 0x000191c25ca8 in __CFDataDeallocate+0x5c (CoreFoundation:arm64e+0x1fca8)
#2 0x000191d56940 in _CFRelease+0x124 (CoreFoundation:arm64e+0x150940)
#3 0x00019f8e4540 in DSIdentity::~DSIdentity()+0x80 (OSServices:arm64e+0xe540)
#4 0x00019f8e45ec in DSUserIdentity::~DSUserIdentity()+0xc (OSServices:arm64e+0xe5ec)
#5 0x000191d56940 in _CFRelease+0x124 (CoreFoundation:arm64e+0x150940)
#6 0x000191c21b28 in __CFBasicHashDrain+0x1a8 (CoreFoundation:arm64e+0x1bb28)
#7 0x000191d56940 in _CFRelease+0x124 (CoreFoundation:arm64e+0x150940)
#8 0x00019f8ec1bc in DSIdentityQuery::~DSIdentityQuery()+0x88 (OSServices:arm64e+0x161bc)
#9 0x00019f8ec220 in DSIdentityQuery::~DSIdentityQuery()+0xc (OSServices:arm64e+0x16220)
#10 0x000191d56940 in _CFRelease+0x124 (CoreFoundation:arm64e+0x150940)
#11 0x000107eda344 in eka::posix::memory::CFReleaseDeleter<__CSIdentityQuery*>::operator()(__CSIdentityQuery*) const+0x3c (libxxx.dylib:arm64+0x9a344)
#12 0x000107eda1c8 (libxxx.dylib:arm64+0x9a1c8)
#13 0x000107eda010 (libxxx.dylib:arm64+0x9a010)
#14 0x000107e43424 (libx.dylib:axxrm64+0x3424)
#15 0x000107e41cc4 in my::helper::EnumerateUsers(std::__1::function<void (my::helper::UserInfo&&, bool&)> const&, unsigned int)+0xf7c (libxxx.dylib:arm64+0x1cc4)
...
previously allocated by thread T240 here:
#0 0x000109b0938c in malloc+0x78 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3d38c)
#1 0x0001919b39d4 in _malloc_type_malloc_outlined+0x60 (libsystem_malloc.dylib:arm64e+0x1d9d4)
#2 0x000191d11c34 in __CFDataInit+0x214 (CoreFoundation:arm64e+0x10bc34)
#3 0x00019f8e3228 in DSIdentityRecord::addJPEGData(char const*, unsigned int, unsigned int)+0x28 (OSServices:arm64e+0xd228)
#4 0x00019f8e627c in DSIdentity::CreateIdentityFromDSAttributeList(__CFAllocator const*, unsigned int, tDataBuffer*, unsigned int, long, bool, DSIdentityAuthority&, tDirStatus*)+0x1c8 (OSServices:arm64e+0x1027c)
#5 0x00019f8ecb64 in DSIdentityQuery::consumeRecordData(unsigned int, tDataBuffer*, long)+0xb4 (OSServices:arm64e+0x16b64)
#6 0x00019f900e2c in findRecordsWithNames+0xd0 (OSServices:arm64e+0x2ae2c)
#7 0x00019f8ec49c in DSIdentityQuery::performQuery(__CFError**)+0x1c4 (OSServices:arm64e+0x1649c)
#8 0x00019f8ec5c4 in DSIdentityQuery::execute(unsigned long, __CFError**)+0x40 (OSServices:arm64e+0x165c4)
#9 0x00019f8e06f4 in CSIdentityQueryExecute+0x2c (OSServices:arm64e+0xa6f4)
#10 0x000107e4144c in my::helper::EnumerateUsers(std::__1::function<void (my::helper::UserInfo&&, bool&)> const&, unsigned int)+0x704 (libxxx.dylib:arm64+0x144c)
EnumerateUsers is our function which basically does this (simplified, error checking skipped):
unique_cfref<CSIdentityQueryRef> query(CSIdentityQueryCreate(kCFAllocatorDefault, kCSIdentityClassUser, CSGetLocalIdentityAuthority()));
CSIdentityQueryExecute(query.get(), 0, &error);
unique_cfref<CFArrayRef> userIdentities(CSIdentityQueryCopyResults(query.get()));
auto userIdentitiesCount = CFArrayGetCount(userIdentities.get());
for (CFIndex i = 0; i < userIdentitiesCount; ++i)
{
// do something including calling getpwuid()
}
unique_cfref is just a std::unique_ptr wrapper that calls CFRelease when we goes out of scope.
Looks like something in OpenDirectory tries to access released data (weak references and delayed processing?). The problem seems to occur on macOS 15.
Is there any bug/regression, should we file a feedback? Or maybe we do something wrong?
I want to make a app that indicates that the app is recording in the background using a indicator on the dynamic island or on the top of the phone screen but i can't figure it out on Xcode. Saw a guy do it by making live activities true but can't seem to find that option in background mode in capabilities. any ideas?
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
I'm reading the "Testing Age Assurance in Sandbox" doc, but I couldn't figure out the step:
2. Tap Sandbox Testing from the main menu
Where is the "main menu"?
关于通过Advanced commerce API 创建SKU,有几个问题:
1、通过Advanced commerce API创建的自动续费订阅的SKU是否支持推介优惠、促销优惠?如果可以,是在苹果connect设置吗?
2、已订阅通过connect创建的SKU的用户,是否可以重复订阅通过Advanced commerce API创建的SKU?还是要通过Advanced commerce API变更订阅?
3、Advanced commerce API创建的SKU ,用户订阅成功后,续费的扣款是否仍由苹果发起?还是由开发者自行发起?
Hello,
In my iOS/SwiftUI/SwiftData app, I want the user to be able to hit [Cancel] from editing in a detail screen and return to the previous screen without changes being saved.
I believed that setting autosaveEnabled to false and/or calling .rollback would prevent changes from being saved, unless/until I call .save() when the user clicks [Save], but this does not seem to be correct.
I set modelContext.autosaveEnabled = false and I call modelContext.rollback() when the user hits [Cancel], but any changes they made are not rolled back, but saved even if I don’t call save().
I have tried setting autosaveEnabled to false when I create the ModelContainer on a @MainActor function when the App starts, and in the detail/edit screen’s .onAppear(). I can see that .rollback is being called when the [Cancel] button is tapped. In all cases, any changes the user made before hitting [Cancel] are saved.
The Developer Documentation on autosaveEnabled includes this:
“The default value is false. SwiftData automatically sets this property to true for the model container’s mainContext."
I am working on the mainContext, but it appears that setting autosaveEnabled to false has no effect no matter where in the code I set it.
If someone sees what I am doing wrong, I’d sure appreciate the input. If this description doesn’t explain the problem well enough, I’ll develop a minimal focused example.
where can i get apple's all device hardware vid and pid ?
Topic:
App & System Services
SubTopic:
Hardware
I am new to Find My network development and i am going to use Nordic solution for my FMN application.
I have asked the MFi representative to enable the "Find My network" in our MFi portal. But there are just a sets of PDF in the "Find My network" under "Technology" in MFi Portal.
Is there any Find My network Supplementary Agreement in MFi portal? Is it a PDF or where can i find it?
Because I need to sign this document back to Nordic solution representative. But it seems there are no such
FMN Supplementary Agreement.
I posted about this about 5 years ago, and now at last it's close to being finished.
The main problem that I now have is related to matching up DWARF debuginfo and global variables. This works fairly well on macOS 10.14. On 10.15 much less so, and I think that the reason is how the macho data is mmap'd.
When Valgrind runs it does the job of the OS and loads the guest exe into memory. It'll then load and run dyld in Valgrind.
I can get memory map debug traces. In one test with a problem I see 4 load segments. __DATA_CONST and __DATA both have prot 3 (RW) so we load them RW and not R then RW.
Then I think that dyld munmaps and re mmaps the _DATA_CONST segment as RO. Valgrind works based on mmaps triggering reading debuginfo. I don't think that it handles munmap correctly. I need to debug that a lot more - I can see the changed mappings in the debug output but I don't see exactly what is happening with munmap and mmap (unless dyld is doing that on a section by basis).
Does what I'm saying about the mappings make any sense?
Topic:
App & System Services
SubTopic:
Core OS
While preparing my app for Declared Age Range capability usage, I've noticed a weird behaviour: the same code works for iOS, but not for macOS.
My project uses same target for both platforms, so the capability is enabled for both platforms. The business logic layer is also shared across between platforms. Both UI layers are writter in SwiftUI.
The iCloud account used for testing on iOS and macOS devices is the same, so even the consent is shared across both devices.
While requestAgeRange(ageGates:) seems to work just fine for iOS app, for macOS app it always throws Not available error (DeclaredAgeRange.AgeRangeService.Error.notAvailable)
Am I missing something? Could the API be somehow unavailable for macOS? Should I use AgeRangeService.shared.requestAgeRange(ageGates:in:) for macOS instead of SwiftUI's @Environment-based approach?
Also, after giving permission, is there a way to actually revoke it? In Age Range for Apps menu I can only view the list of apps that have my consent to share my age range, but not the ability to revoke it.
Hello,
Recently we got a question about the keyboard sensor data collection in our research project:
"For the typing statistics, was any typing included or only messaging and notes? E.g., typing in the browser, phone search, calendar, etc?"
While I believe it should be any typing included, I was not able to find a document explicitly stating that. Could you help to confirm it or guide me to any documentation explaining it?
Thanks!
I am currently encountering a problem: during the process of uploading a large file, I have moved the file that was not successfully uploaded to the trash can. These two operations have been tested to be serial (triggering the 'create Item' callback first, followed by the 'modify Item' callback), which means that the file must be uploaded before it can be moved to the recycle bin (which can also result in the file being stored in the cloud recycle bin). I want to implement: directly interrupt this upload process and then do not complete the upload. How can I achieve this? Please help me. Thank you
Topic:
App & System Services
SubTopic:
Core OS
Tags:
Foundation
Swift
File Provider
Files and Storage