Posts under App & System Services topic

Post

Replies

Boosts

Views

Activity

Usb Keyboard will wake up the system when sending command to it at system start to sleep
Development environment: Electron 30.2.0 Run-time configuration: macOS 14.5 (23F79) DESCRIPTION OF PROBLEM I have one keyboard which will wake up the Mac OS from sleep when sending command to it at the time system starting to sleep. But this keyboard will not have such problem on Window OS, I don't know why sending command to that keyboard will wake up the Mac OS system from sleep. Does anyone know from a hardware or software point of view, what kind of usb keyboard operation will cause the macos system to wake up? Or can someone give us guidance, how to debug and solve the usb keyboard caused by the wake up system problem on Mac OS system? STEPS TO REPRODUCE Sending command to that keyboard when the system start to sleep
0
0
212
Sep ’24
ANCS
After a prolonged BLE connection, we have noticed that ANCS frequently pushes a large number of "remove" messages (event ID 0x02), after which the device no longer receives any notifications. Is this behavior a result of system design, or could it be a potential bug? I would appreciate any insights or experiences that others can share.
2
0
366
Sep ’24
BLE Background Fetching - Polling vs. Notify
I’m working on an iOS app that uses Bluetooth Low Energy (BLE) to communicate with a peripheral device. Currently, we scan by service ID and successfully connect in the background. Would it be acceptable (and within Apple's guidelines) to poll data from the device every 5 seconds while in the background? Or is it required to have the BLE device notify?
1
0
352
Oct ’24
Core Data transformable vs relationship
I'm working on an app that is using Core Data. I have a custom big number class that boils down to a double and an integer, plus math functions. I've been using transformable types to store these big numbers, but its forcing me to do a lot of ugly casts since the number class is used throughout the application. I figure I can either have my stored values be named differently (e.g. prefix with underscore) and have a computed variable to cast it to the correct type, or find some way to move the big number class to being an NSManagedObject. The issue with this is that the inverse relationships would be massive for the big number class, since multiple entities use the class in multiple properties already. Would it be recommended that I just keep using Transformable types and casts to handle this, or is there some standard way to handle a case like this in Core Data relationships?
0
0
321
Oct ’24
Opening file from iCloud Desktop versus Mail attachment
Am developing an iOS App, which uses a ZipFoundation wrapper around Compression. In XCode, have exported a document type with extension '.MU' in the Info.plist. On iPhone, when attempting to open archive called: 'Snapshot-test.mu' can OPEN as a mobile email attachment but FAILED via Files App referring to "iCloud Drive/Desktop" Here are the respective URLS "file:///private/var/mobile/Containers/Data/Application/<UniqueID>/Documents/Inbox/Snapshot-test.mu" "file:///private/var/mobile/Library/Mobile%20Documents/com~apple~CloudDocs/Desktop/Snapshot-test1.mu" Two questions: Is it possible to grant access to files residing remotely in iCloud? Is "iCloud Drive/Desktop" unique, whereas other iCloud locations would be OK?
0
0
983
Oct ’24
Merchant ID
Our team want to transfer money to card with Apple Pay. I am iOS developer. I have access Admin. I created Merchant ID. I added domain. Our backend team uploaded .txt file to database. Url is working, you can see .txt file content when open it. But when I press verify I get error as following: Domain verification failed. Unable to access verification file on server. Confirm that the file is in the correct location, proxies and redirects are not enabled, and the documented Apple Domain Verification IP addresses can access your server. Please, help to fix this problem.
0
0
289
Sep ’24
Exporting/storing user HealthKit data for analytics in database
I am having trouble finding clear information about this. I want my app to collect and aggregate user data to provide useful analytics to the user and userbase. Can data accessed from HealthKit be stored on a database outside the Apple ecosystem and used for analytics? The data will not be used for marketing and will not be shared. It will be used only for the benefit of the user's understanding of their health and for the community that uses the app. If not, what if the data is anonymized first before being exported to a 3rd party database?
0
0
404
Oct ’24
How the iOS 18 Control Widget displays an AppIntentError to the user.
My app is an outdoor exercise tracking app that allows you to start exercising from the Control widget。 I want to prompt the user with an AppIntentError.PermissionRequired.location error when the user doesn't authorize Core Location permissions. When I throw error in the Intent, tap the Control widget doesn't do anything and doesn't give the user any indication of what's happening
2
0
537
Sep ’24
Sorting with Complex & Arbitrary Nested Models
I’m developing an app for inspections that allows users to develop their own template for inspections. Because of this, my data structure has become more than a little complex (see below). This structure does allow a great deal in flexibility, through, as users can add groups, rows, and individual fields as needed. For example, users can add a header group, then a row to the header with fields for the Building Number, Unit Number, & Inspection Date. However, I don’t have an efficient way to sort the inspections by the values in these fields. SwiftData sorting is keypath based, which won’t allow me to sort the inspections based on the values only in fields with specific labels. As an alternative, I can query for fields with a specific label and do a compactMap to the inspection. But this doesn’t scale well when working with potentially hundreds or thousands of inspections as compactMap takes a lot longer then the query takes. It also doesn’t work well if I want to filter inspections or sort using values in multiple user defined fields. Models below are greatly simplified to just get the point across. More than happy to provide some additional code if asked when I’m back at my laptop with the source code. (Typing this on my iPad at the moment) @Model final class Inspection { // init and other fields var groups: [Group]? } @Model final class Group { // init and other fields @Relationship(inverse: \Inspection.groups) var inspection: Inspection? var rows: [Row]? } @Model final class Row { // init and other fields @Relationship(inverse: \Group.rows) var group: Group? var fields: [Field]? } @Model final class Field { // init and other fields var label: String? var type: FieldType // enum, denoting what type of data this is storing var stringValue: String? var boolValue: Bool? var dateValue: Date? @Attribute(.externalStorage) var dataValue: Data? @Relationship(inverse: \Row.fields) var row: Row? }
1
0
376
Sep ’24
Backup and Restore a Flutter SQLite database file to iCloud
I'm managing the database with SQLite in Flutter. I want to enable iCloud backup and restore on the Swift side when called from Flutter. I am using the following source code, but it is not working. What could be the cause? Could you provide a method and countermeasure? private func saveFileToICloud(fileName: String, localDatabasePath: String, result: @escaping FlutterResult) { guard let containerName = Bundle.main.object(forInfoDictionaryKey: "ICLOUD_CONTAINER_NAME") as? String else { result(FlutterError(code: "NO_ICLOUD_CONTAINER", message: "iCloud container is not available", details: nil)) return } guard let containerURL = FileManager.default.url(forUbiquityContainerIdentifier: containerName) else { result(FlutterError(code: "NO_ICLOUD_CONTAINER", message: "iCloud container is not available", details: nil)) return } let fileURL = containerURL.appendingPathComponent(fileName) let sourceURL = URL(fileURLWithPath: localDatabasePath) do { if FileManager.default.fileExists(atPath: fileURL.path) { try FileManager.default.removeItem(at: fileURL) } try FileManager.default.copyItem(at: sourceURL, to: fileURL) result("File saved successfully to iCloud: \(fileURL.path)") } catch { result(FlutterError(code: "WRITE_ERROR", message: "Failed to write file to iCloud", details: error.localizedDescription)) } } private func readFileFromICloud(fileName: String, localDatabasePath: String, result: @escaping FlutterResult) { let containerName = ProcessInfo.processInfo.environment["ICLOUD_CONTAINER_NAME"] guard let containerURL = FileManager.default.url(forUbiquityContainerIdentifier: containerName) else { result(FlutterError(code: "NO_ICLOUD_CONTAINER", message: "iCloud container is not available", details: nil)) return } let fileURL = containerURL.appendingPathComponent(fileName) let sourceURL = URL(fileURLWithPath: localDatabasePath) do { if FileManager.default.fileExists(atPath: sourceURL.path) { try FileManager.default.removeItem(at: sourceURL) } try FileManager.default.copyItem(at: fileURL, to: sourceURL) result("File restored successfully to sqlite: \(sourceURL.path)") } catch { result(FlutterError(code: "READ_ERROR", message: "Failed to read file from iCloud", details: error.localizedDescription)) } }
0
0
616
Oct ’24
Healthkit HKWorkoutSession state not transitioning
Im building a workout app to track swimming workouts for watchos 11. Triggering .prepare() on my HKWorkoutSession does not change the session state HKWorkoutSessionState. Below is my prepare function which should transition the session state to HKWorkoutSessionStatePrepared. Nothing is thrown in the delegates, the state just wont change? I have tried erasing, restarting, use another version of xcode and another simulator runtime. func prepare() { guard self.session == nil else { fatalError("Session already exist") } // Configure Workout Type let config = HKWorkoutConfiguration() config.activityType = .swimming config.swimmingLocationType = .openWater config.locationType = .outdoor self.Workoutconfig = config // Create Session do { guard store.authorizationStatus(for: .workoutType()) == .sharingAuthorized else { fatalError("Lack of permission to start workout") } let session = try HKWorkoutSession(healthStore: store, configuration: config) self.session = session self.builder = session.associatedWorkoutBuilder() Logger.diveController.info("Successfully created workout session") builder?.dataSource = HKLiveWorkoutDataSource(healthStore: store, workoutConfiguration: config) self.session?.delegate = self self.builder?.delegate = self if self.session == nil { fatalError("No workout session created") } if self.builder == nil { fatalError("No workout builder created") } self.session?.prepare() logger.debug("Session Started at: \(self.session?.startDate ?? Date())") logger.debug("Session State: \(self.session?.state.description ?? "")") if self.session?.state != .prepared { reset() fatalError("Failed To Prepare") } } catch { Logger.diveController.error("Error starting workout session: \(error.localizedDescription)") } }
1
0
913
Oct ’24
HealthKit data - Is HKStatisticsCollectionQuery slow?
Hi, I am using HealthKit for the first time. I am using HKStatisticsCollectionQuery. I am running my code iOS 17 on a physical iPhone. It takes several seconds to query data, for example 1 day worth of heart rate at 1 minute resolution. I changed the resolution to 1 hour, expecting it to be faster, but it's pretty much the same… I have been following the official documentation and sample code. I also compiled in Release, but that didn't really help for HKStatisticsCollectionQuery. I quickly looked with Instruments, the app is spending a lot of time in decoding data with NSXPCDecoder. Is there a way to speed data retrieval? Or this is "expected" latency?
2
0
1k
Oct ’24
AU Plugin Not Connecting to DriverKit Driver in Sandboxed Host
Hello, I'm developing a custom AU plugin that needs to connect to a DriverKit driver. Using the DriverKit sample (https://github.com/DanBurkhardt/DriverKitUserClientSample.git), I was able to get a standalone app to connect to the driver successfully. However, the AU plugin, running in a sandboxed host, isn't establishing the connection. I’ve already added the app sandbox entitlement, but it hasn’t helped. Any advice on what might be missing? TIA!
1
0
567
Oct ’24
question about App Store Server Notifications
I have 2 subscriptions, monthly and year first:DID_CHANGE_RENEWAL_PREF + DOWNGRADE: Customer downgrades a subscription within the same subscription group; The current subscribe is year;if i change to month;when the subscribe year was expire,Automatic renewal will change to month second:DID_CHANGE_RENEWAL_PREF+UPGRADE: Customer upgrades a subscription within the same subscription group. The current subscribe is month;if i change to year;I need to pay for the annual subscription immediately;and The subscription immediately switches to the annual third:DID_CHANGE_RENEWAL_PREF subtype is None Customer reverts to the previous subscription, effectively canceling their downgrade. what this mean? This is Test Env,month is five minutes;year is one hour ①My current subscription is an annual, startTime:2024-10-02 15:04:58 ,expireTime:2024-10-02 16:04:58 ②first DOWNGRADE to month,at 2024-10-02 15:14:16 ②after 38 minutes,I change to the annual subscribe;at 2024-10-02 15:52:00 in the end,the Notification purchaseDate 2024-10-02 15:52:00;expiresDate 2024-10-02 16:52:00; So When I get NotificationType=DID_CHANGE_RENEWAL_PREF,NotificationSubType=None,Do I need to create a new subscription for the users? Is it the latest notice of purchaseDate and expiresDate, for a year? The appleNotification Payload as follows: JWSTransactionDecodedPayload( originalTransactionId='2000000731045285', transactionId='2000000731088945', webOrderLineItemId='2000000076096676', bundleId='app.xxxx', productId='com.xxxx.365', subscriptionGroupIdentifier='21514251', purchaseDate=1727855520000, 2024-10-02 15:52:00 originalPurchaseDate=1727852699000, 2024-10-02 15:04:59 expiresDate=1727859120000, 2024-10-02 16:52:00 quantity=1, type=<Type.AUTO_RENEWABLE_SUBSCRIPTION: 'Auto-Renewable Subscription'>, rawType='Auto-Renewable Subscription', appAccountToken='fa37b7a2-2b0b-43cb-8fda-a1fb21168efe', inAppOwnershipType=<InAppOwnershipType.PURCHASED: 'PURCHASED'>, rawInAppOwnershipType='PURCHASED', signedDate=1727855526632, 2024-10-02 15:52:06 revocationReason=None, rawRevocationReason=None, revocationDate=None, isUpgraded=None, offerType=None, rawOfferType=None, offerIdentifier=None, environment=<Environment.SANDBOX: 'Sandbox'>, rawEnvironment='Sandbox', storefront='CAN', storefrontId='143455', transactionReason=<TransactionReason.PURCHASE: 'PURCHASE'>, rawTransactionReason='PURCHASE', currency='CAD', price=14990, offerDiscountType=None, rawOfferDiscountType=None) JWSRenewalInfoDecodedPayload( expirationIntent=None, rawExpirationIntent=None, originalTransactionId='2000000731045285', autoRenewProductId='com.xxxx.365', productId='com.xxxx.365', autoRenewStatus=<AutoRenewStatus.ON: 1>, rawAutoRenewStatus=1, isInBillingRetryPeriod=None, priceIncreaseStatus=None, rawPriceIncreaseStatus=None, gracePeriodExpiresDate=None, offerType=None, rawOfferType=None, offerIdentifier=None, signedDate=1727855526632, 2024-10-02 15:52:06 environment=<Environment.SANDBOX: 'Sandbox'>, rawEnvironment='Sandbox', recentSubscriptionStartDate=1727852698000, 2024-10-02 15:04:58 renewalDate=1727859120000, 2024-10-02 16:52:00 currency='CAD', renewalPrice=14990, offerDiscountType=None, rawOfferDiscountType=None, eligibleWinBackOfferIds=None)
0
0
416
Oct ’24
Issues with Apple Nearby Interaction app not detecting DWM3001CDK accessory
Hi everyone, I’m having trouble getting my iPhone 11 to detect a DWM3001CDK as an accessory using the Apple Nearby Interaction app. Here’s the background: Two years ago, I successfully tested UWB ranging between the same devices (iPhone 11 and DWM3001CDK, which is based on the Qorvo DW3110 IC and an nRF52833 SoC with Bluetooth 5.2). At that time, the Nearby Interaction app was in beta and worked well for my tests. Now, with the stable version of the app, I’m encountering an issue. Here’s what I’ve done so far: I erased the DWM3001C and flashed it with the Qorvo Nearby Interaction firmware (v3.2.0, "DWM3001CDK-QANI-FreeRTOS_full_QNI_3_0_0.hex") using J-Flash Lite V7.86g on Windows. With this configuration, I can connect the iPhone 11 to the accessory using the Qorvo NI apps, both in the foreground and background. However, when I compile and run the project "ImplementingSpatialInteractionsWithThirdPartyAccessories" (available on the Apple Developer website) on my iPhone 11 (running iOS 17.7), the app remains stuck on the "Scanning for accessory" screen and doesn’t find the device, even though I’ve given the app permission to use Bluetooth. Could this be due to an issue with the firmware I flashed on the DWM3001CDK, or might there be something else causing the problem? Any help or insights would be appreciated! Thanks in advance.
0
0
575
Oct ’24
NFCTagReaderSession host card emulation (HCE) exception
I'm trying to read a tag generated by my app that emulates event input tags; in my NFC reader app and I get this error: &lt;NSXPCConnection: 0x300a108c0&gt; connection to service with pid 62 named com.apple.nfcd.service.corenfc: Exception caught during decoding of received selector didDetectExternalReaderWithNotification:, dropping incoming message. Exception: Exception while decoding argument 0 (#2 of invocation): Exception: decodeObjectForKey: class "NFFieldNotificationECP1_0" not loaded or does not exist ( 0 CoreFoundation 0x0000000192b00f2c 76A3B198-3C09-323E-8359-0D4978E156F5 + 540460 1 libobjc.A.dylib 0x000000018a9a32b8 objc_exception_throw + 60 2 Foundation 0x0000000191932584 D27A6EC5-943C-3B0E-8D15-8840FD2914F0 + 38276 3 Foundation 0x0000000191930d10 D27A6EC5-943C-3B0E-8D15-8840FD2914F0 + 32016 4 Foundation 0x000000019198f460 D27A6EC5-943C-3B0E-8D15-8840FD2914F0 + 418912 5 Foundation 0x000000019198c510 D27A6EC5-943C-3B0E-8D15-8840FD2914F0 + 406800 6 Foundation 0x00000001919e4cf4 D27A6EC5-943C-3B0E-8D15-8840FD2914F0 + 769268 7 Foundation 0x00000001919e3a60 D27A6EC5-943C-3B0E-8D15-8840FD2914F0 + 764512 8 Foundation 0x00000001919e31c4 D27A6EC5-943C-3B0E-8D15-8840FD2914F0 + 762308 9 Foundation 0x00000001919e307c D27A6EC5-943C-3B0E-8D15-8840FD2914F0 + 761980 10 libxpc.dylib 0x00000001ef5a1cbc CD0F76A8-713A-3FDB-877E-386B089BC2D1 + 72892 11 libxpc.dylib 0x00000001ef5a3908 CD0F76A8-713A-3FDB-877E-386B089BC2D1 + 80136 12 libdispatch.dylib 0x000000010401e87c _dispatch_client_callout4 + 20 13 libdispatch.dylib 0x000000010403bec4 _dispatch_mach_msg_invoke + 516 14 libdispatch.dylib 0x00000001040264a4 _dispatch_lane_serial_drain + 376 15 libdispatch.dylib 0x000000010403cea8 _dispatch_mach_invoke + 480 16 libdispatch.dylib 0x00000001040264a4 _dispatch_lane_serial_drain + 376 17 libdispatch.dylib 0x000000010402743c _dispatch_lane_invoke + 460 18 libdispatch.dylib 0x0000000104034404 _dispatch_root_queue_drain_deferred_wlh + 328 19 libdispatch.dylib 0x0000000104033a38 _dispatch_workloop_worker_thread + 444 20 libsystem_pthread.dylib 0x00000001ef550934 _pthread_wqthread + 288 21 libsystem_pthread.dylib 0x00000001ef54d0cc start_wqthread + 8 ) ( 0 CoreFoundation 0x0000000192b00f2c 76A3B198-3C09-323E-8359-0D4978E156F5 + 540460 1 libobjc.A.dylib 0x000000018a9a32b8 objc_exception_throw + 60 2 Foundation 0x000000019198f680 D27A6EC5-943C-3B0E-8D15-8840FD2914F0 + 419456 3 Foundation 0x000000019198c510 D27A6EC5-943C-3B0E-8D15-8840FD2914F0 + 406800 4 Foundation 0x00000001919e4cf4 D27A6EC5-943C-3B0E-8D15-8840FD2914F0 + 769268 5 Foundation 0x00000001919e3a60 D27A6EC5-943C-3B0E-8D15-8840FD2914F0 + 764512 6 Foundation 0x00000001919e31c4 D27A6EC5-943C-3B0E-8D15-8840FD2914F0 + 762308 7 Foundation 0x00000001919e307c D27A6EC5-943C-3B0E-8D15-8840FD2914F0 + 761980 8 libxpc.dylib 0x00000001ef5a1cbc CD0F76A8-713A-3FDB-877E-386B089BC2D1 + 72892 9 libxpc.dylib 0x00000001ef5a3908 CD0F76A8-713A-3FDB-877E-386B089BC2D1 + 80136 10 libdispatch.dylib 0x000000010401e87c _dispatch_client_callout4 + 20 11 libdispatch.dylib 0x000000010403bec4 _dispatch_mach_msg_invoke + 516 12 libdispatch.dylib 0x00000001040264a4 _dispatch_lane_serial_drain + 376 13 libdispatch.dylib 0x000000010403cea8 _dispatch_mach_invoke + 480 14 libdispatch.dylib 0x00000001040264a4 _dispatch_lane_serial_drain + 376 15 libdispatch.dylib 0x000000010402743c _dispatch_lane_invoke + 460 16 libdispatch.dylib 0x0000000104034404 _dispatch_root_queue_drain_deferred_wlh + 328 17 libdispatch.dylib 0x0000000104033a38 _dispatch_workloop_worker_thread + 444 18 libsystem_pthread.dylib 0x00000001ef550934 _pthread_wqthread + 288 19 libsystem_pthread.dylib 0x00000001ef54d0cc start_wqthread + 8 )
2
0
668
Sep ’24