Posts under App & System Services topic

Post

Replies

Boosts

Views

Activity

Questions about CloudKit cross-device synchronization
The same macOS app is logged into the same iCloud account on two Macs. The apps on both devices can sync data with iCloud, but the data between them is isolated. When I was developing, I just enabled the CloudKit(SwiftData host in iCloud) capability and did not do anything special. I thought that the same app and the same iCloud account should sync the same data between different devices. Why is the cloud data on these two Macs isolated?
1
0
471
Nov ’24
Scanning Thread accessories in HomeKit
I'm trying to browse my Homekit accessories and try to show the different accessories communication protocols, i.e. Wifi, Thread, Zigbee, Z-wave! Zigbee and Z-wave I can have hard-coded depending on model because I have so few! But…. I can easily find all accessories which are wifi attached by using: isBriged == false and uniqueIdentifiersForBridgedAccessories == nil However, I can see that some of the accessories are thread enabled (I have read the documentation for the accessory) but still in the list. So, my questions: Are there any attributes in the accessory that is unique for a Thread accessory? for accessory in accessories { if(accessory.isBridged == false && accessory.uniqueIdentifiersForBridgedAccessories == nil ) { // Can be a Wifi device but need more controls // requiresThreadRouter??? if (true) { wifiAccessaries.append(accessory) } } }
3
0
455
Dec ’24
iOS Secure WebSocket Connection Timing Out & Map Sync Issues with Custom SSL Server
Hello, all, I'm new to iOS development and working on a project with the following setup: Architecture: Windows PC running Ubuntu (WSL) hosting a WebSocket Server with self-signed SSL Python GUI application as a client to control iOS app iOS app as another client on physical iPhone Server running on wss://xxx.xxx.xxx.1:8001 (this is the mobile hotspot IP from Windows PC which the iPhone is needed to connect to as well) Current Status: ✓ Server successfully created and running ✓ Python GUI connects and functions properly ✓ iOS app initially connects and communicates for 30 seconds ✗ iOS connection times out after 30 seconds ✗ Map updates from GUI don't sync to iOS app Error Message in Xcode terminal: WebSocket: Received text message 2024-11-25 15:49:03.678384-0800 iVEERS[1465:454666] Task <CD21B8AD-86D9-4984-8C48-8665CD069CC6>.<1> finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2103, _NSURLErrorFailingURLSessionTaskErrorKey=LocalWebSocketTask <CD21B8AD-86D9-4984-8C48-8665CD069CC6>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalWebSocketTask <CD21B8AD-86D9-4984-8C48-8665CD069CC6>.<1>" ), NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=wss://xxx.xxx.xxx.1:8001/, NSErrorFailingURLKey=wss://xxx.xxx.xxx.1:8001/, _kCFStreamErrorDomainKey=4} Technical Details: Using iOS built-in URLSessionWebSocketTask for WebSocket connection Self-signed SSL certificate Transport security settings configured in Info.plist Map updates use base64 encoded PNG data Questions: What's causing the timeout after 30 seconds? How can I maintain a persistent WebSocket connection? Why aren't map updates propagating to the iOS client? Any guidance/suggestions would be greatly appreciated. Please let me know if additional code snippets would help on what I currently have.
0
0
447
Nov ’24
Troubles Writing to Private Folder while Testing with TestFlight
I've developed an app that allow me to send messages to all users by entering a record in Public database. On each users device, the app takes that Public record and creates a record in their Private database to track the Read and Deleted status. It works flawlessly on the simulator and about 1/3 of the devices enrolled in my TestFlight. The other 2/3 are unable to write to their Private database. In fact, the CKContainer.default().privateCloudDatabase.save() operation causes the app to crash if I let it run. I've looked at every Google link and I just can't figure out why this works for 1/3 of the users, but not the other 2/3. Incidentally, the 2/3 of the group that can't save to their Private database are also unable to save their Notification Subscription. All devices are running iOS 18.0 or better iPhone 11 through 16 in testing pool. Each portion of the working/not working group are a mix of iPhone versions. if !found && checkIcloudStatus() { CKContainer.default().privateCloudDatabase.save(loadPrivateData(n: processedMessages[index].recordName)) { returnedRecord, returnedError in print("Adding new message to Private and error is: \(String(describing: returnedError))") DispatchQueue.main.async { self.processedMessages[index].record = returnedRecord ?? CKRecord(recordType: "messages_private") self.processedMessages[index].unRead = true self.processedMessages[index].deleted = false } } } func loadPrivateData(n: String) -> CKRecord { let record = CKRecord(recordType: "messages_private") record["deleted"] = "false" record["messageId"] = n record["unRead"] = "true" return record }
0
0
308
Nov ’24
continue UserActivity in AppDelegate not working after firing completion(INSendPaymentIntentResponse(code: .failureRequiringAppLaunch, userActivity: userActivity ))
func handle(intent: INSendPaymentIntent, completion: @escaping (INSendPaymentIntentResponse) -> Void) { if let _ = intent.payee, let currencyAmount = intent.currencyAmount { let userActivity = NSUserActivity(activityType: "com.rapipay.nye.test.failure") userActivity.userInfo = ["amount": Int(truncating: currencyAmount.amount!)] completion(INSendPaymentIntentResponse(code: .failureRequiringAppLaunch, userActivity: userActivity )) return } } func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([any UIUserActivityRestoring]?) -> Void) -> Bool { print("ddddd") return true } this code is perfectly working on simulator and even i fi user userActivity as nil, continue userActivity is called, but on device it is not called Siri is working, asking for name and amount and handler is also called and opens app but does not pass intent or userActivity
7
0
801
Nov ’24
MacBook peripherals malfunction after allowed Driver Extensions
Hi, I’m developing my own Pcie Ethernet driverkit. My Pcie Ethernet card connect on Razor Core X and connect to MacBook via thunderbolt 3. The Problem: Click Driver application and send activate system extension request, then go to System setting -> Privacy & Security, in Extension section ->click “allow” , the peripherals malfunction immediately after "allow" clicked and type in the password.I can't control all peripherals devices like touchpad, keyboard and all of thunderbolt ports. However, it can regain functionality after plugging and unplugging the device. results I expected: User approve Driver Extensions enable and all peripherals work normally and Ethernet Card works. Has anyone encountered this problem? maybe something wrong in "OSSystemExtensionRequestDelegate" but I have no idea how to fix it Please Help. My Xcode version is Version 15.3 (15E204a). Thanks
0
0
530
Nov ’24
Texts being received to incorrect phone number
Anne has two phone numbers, work and personal. Beth saved both phone numbers for Anne under one contact profile. When Beth sends a text to Anne's work phone, it is received on Anne's personal phone instead. We have verified only one phone number is set up under Messages settings, signed out of messages, restarted the phones. Any other fixes or suggestions?
0
0
346
Nov ’24
Premature DeviceActivityEvent Triggering
Our app monitors device usage and applies a shield when the set time limit is reached. Multiple DeviceActivitySchedules can be present, each with different time limits. To display notifications at 50% of the total limit for each DeviceActivitySchedule, we set a warning time at half of the total time. However, we occasionally receive premature event callbacks. For example, consider a schedule from 13:00 to 13:30 with a single event threshold at 10 minutes and a warning time of 5 minutes. The 'eventDidReachThreshold' callback is delivered prematurely, along with the 'eventWillReachThresholdWarning' callback, at 13:10. Additionally, in some cases, when one DeviceActivitySchedule ends and the next begins immediately, DeviceActivityEvents registered for the new DeviceActivitySchedule are delivered prematurely along with the schedule start callback. For example, consider there are two DeviceActivitySchedules from 12:00 to 13:00 and from 13:00 to 14:00, each with a limit of 10 minutes and a warning time of 5 minutes. When the first schedule ends and the next begins at 13:00, the 'eventDidReachThreshold' callbacks for the events registered in the second schedule are delivered prematurely, along with the 'intervalDidStart' callback.
1
0
404
Nov ’24
Issue with geolocation without using maps
I have an application that uses geolocation to track the user’s location and trigger actions when the app is in either the foreground or background. Currently, it seems that region entry is not triggered unless an app like Maps (which actively uses location services) is opened. The location permissions are correctly set to “Always” with precise location enabled. We are using geofencing to setup region and trigger actions when entering or leaving. Is there something I’m missing in the configuration that could be preventing region monitoring from triggering properly when the app is in use or in background?
4
0
518
Nov ’24
siri crash
Question: A very small number of users experience this crash: NSInternalInconsistencyException:Use of the class INVocabulary requires the entitlement com.apple.developer.siri. Make sure you have enabled the Siri capability in your Xcode project. But our project definitely has siri configured to be available. During app startup, calling the following code causes a crash: INVocabulary *vocabulary = [INVocabulary sharedVocabulary]; Now that we can't figure it out, is it a bug in the system?
0
0
278
Nov ’24
Command line utility launched by XCode asks for permission, delays reception
I have a command line app under active development in XCode. It is based on receiving multicast traffic and processing it. I generate this traffic with another app, and generally just leave it running. When I do a build and run in XCode, I get a message asking me for Local Access. If I click yes, no network traffic will be received. I need to restart the command line tool multiple times until I get access. I'm also getting a ton of repeated entries in my Setting-&gt;Privacy-&gt;Local Access. If I configure xcode to launch with terminal, it does work, but that's not a great solution because of the external window (and the fact that I have terminal set "close if exit cleanly", so I lose my data. I can change that setting, but it is fairly inconvenient, and I don't get the console history in XCode. Is there a way to allow my apps to run from xcode without the pop-up or with the delay in activating the network and creating new entries in the Settings? Thanks!
4
0
389
Dec ’24
Undo in SwiftData deletes all data at once.
When the following models in SwiftData, @Model final class UndoRedoData { var id: [Int] init(id: [Int]) { self.id = id } } I created the following code. struct ContentView: View { @ObservedObject var swiftDataViewModel = SwiftDataArrayViewModel.shared @State private var idArray: [Int] = [1,2,3,4] @State private var firstviewSwich: Bool = true @State private var twoviewSwich: Bool = false @State private var threeviewSwich: Bool = false var body: some View { VStack { if firstviewSwich == true { Button(action: addItem) { Text("1.New Item") } } if twoviewSwich == true { Button { forArrayData() } label: { Text("2.Data Road") } } if threeviewSwich == true { Button(action: undoItem) { Text("3.Undo") } } } } private func addItem() { withAnimation { let newItem = UndoRedoData(id: [1,2,3,4]) swiftDataViewModel.taskContext.insert(newItem) do { try swiftDataViewModel.taskContext.save() } catch { print(error) } swiftDataViewModel.fetchItems() firstviewSwich.toggle() twoviewSwich.toggle() } } private func forArrayData() { twoviewSwich.toggle() for data in idArray { swiftDataViewModel.idUndoCreate(id: data, undoManager: swiftDataViewModel.arrayItemUndoManager) } threeviewSwich.toggle() } private func undoItem() { swiftDataViewModel.arrayItemUndoManager.undo() threeviewSwich.toggle() firstviewSwich.toggle() } } class SwiftDataArrayViewModel: ObservableObject { static let shared = SwiftDataArrayViewModel() let modelContainer: ModelContainer @ObservationIgnored lazy var taskContext: ModelContext = { return ModelContext(modelContainer) }() @Published var arrayItems = [UndoRedoData]() @Published var arrayItemUndoManager = UndoManager() init() { let schema = Schema([UndoRedoData.self]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) do { modelContainer = try ModelContainer(for: schema, configurations: [modelConfiguration]) } catch { fatalError(error) } fetchItems() } func fetchItems() { let fetchDescriptor = FetchDescriptor<UndoRedoData>() do { arrayItems = try taskContext.fetch(fetchDescriptor) } catch { fatalError(error) } } func idUndoCreate(id: Int, undoManager: UndoManager?) { undoManager?.registerUndo(withTarget: self) { target in target.removeID() } } func removeID() { if let firstUndoRedoData = arrayItems.first { print("Before Delete:\(firstUndoRedoData.id)") if !firstUndoRedoData.id.isEmpty { firstUndoRedoData.id.removeLast() } print("After Delete:\(firstUndoRedoData.id)") } do { try taskContext.save() } catch { print(error) } fetchItems() } } In this code, 1. Create an Item in New Item, 2. Execute Data Road and register the data in the array that is the same value as the data created in New Item in SwiftData one by one in UndoManager by for data in idArray. This is done because the data in the array and the data created by New Item in SwiftData can be known in advance. private func forArrayData() { twoviewSwich.toggle() for data in idArray { swiftDataViewModel.idUndoCreate(id: data, undoManager: swiftDataViewModel.arrayItemUndoManager) } // class SwiftDataArrayViewModel: ObservableObject func idUndoCreate(id: Int, undoManager: UndoManager?) { undoManager?.registerUndo(withTarget: self) { target in target.removeID() } } After registering in UndoManager, when Undo is executed with 3. Undo, instead of being able to perform Undo where one id is deleted each time, all the data of the id in SwiftData is deleted in a one-time Undo. I would like to be able to delete one id each time Undo is performed and restore them in sequence, but I can only delete them all once. Does this mean that such registration to UndoManager should not be done with for statements, etc.? Or is there another problem in the code? I want to make sure that one id is deleted for each Undo executed.
1
0
796
Dec ’24
Problem with reading NFC tag in background in not working with NFC ISO 14443-3A
Hi folks, I have trouble with reading NFC tag in background while my application is running. I still receives a message in my iPhone 13, NFC tag of web Open "donator.cz" in application Safari. But I would like to open the app Donator which is here: https://apps.apple.com/dk/app/don%C3%A1tor/id6473955033 My NFC chip scanned by "NFC Tools" is ISO 14443-3A (NXP-NTAG213) In the tag is mentioned https://donator.cz/<8digits-number>**text In my Info.plist of application is: <key>LSApplicationQueriesSchemes</key> <array> <string>https://donator.cz</string> </array> <key>com.apple.developer.nfc.readersession.felica.systemcodes</key> <array> <string>12FC</string> </array> <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key> <array> <string>D2760000850101</string> </array> Apple CDN looks like: https://app-site-association.cdn-apple.com/a/v1/donator.cz I have read in Apple documentation https://developer.apple.com/documentation/corenfc/adding-support-for-background-tag-reading that application should be in progress A Core NFC reader session is in progress. How to do it in AppDelegate or SceneDelegate. One note is that everything works properly in case of reading NFC based on button click is pressed. My NFCHandler looks like: // // NFCReader.swift // Donator // // Created by Petr Hracek on 22.11.2024. // import Foundation import UIKit import CoreNFC class NFCHandler: NSObject, NFCNDEFReaderSessionDelegate { var readerSession: NFCNDEFReaderSession? func startBackgroundScanning() { guard NFCNDEFReaderSession.readingAvailable else { return } readerSession = NFCNDEFReaderSession(delegate: self, queue: DispatchQueue.main, invalidateAfterFirstRead: true) readerSession?.alertMessage = "Prilozte NFC tag" readerSession?.begin() } func readTag(session: NFCNDEFReaderSession , tags: [NFCNDEFTag] ) { if tags.count > 1 { // Restart polling in 500ms let retryInterval = DispatchTimeInterval.milliseconds(500) session.alertMessage = "More than 1 tag is detected, please remove all tags and try again." DispatchQueue.global().asyncAfter(deadline: .now() + retryInterval, execute: { session.restartPolling() }) return } // Connect to the found tag and perform NDEF message reading let tag = tags.first! session.connect(to: tag, completionHandler: { (error: Error?) in if nil != error { session.alertMessage = "Unable to connect to tag." session.invalidate() return } tag.queryNDEFStatus(completionHandler: { (ndefStatus: NFCNDEFStatus, capacity: Int, error: Error?) in if .notSupported == ndefStatus { session.alertMessage = "Tag is not NDEF compliant" session.invalidate() return } else if nil != error { session.alertMessage = "Unable to query NDEF status of tag" session.invalidate() return } tag.readNDEF(completionHandler: { (message: NFCNDEFMessage?, error: Error?) in var statusMessage: String if nil != error || nil == message { statusMessage = "Fail to read NDEF from tag" } else { statusMessage = "Found 1 NDEF message" DispatchQueue.main.async { // Process detected NFCNDEFMessage objects. debugPrint(message!) //self.tableView.reloadData() } } session.alertMessage = statusMessage session.invalidate() }) }) }) } /// - Tag: sessionBecomeActive /// This method will called when NFC session become active /// Tells the delegate that the session detected NFC tags with NDEF messages. func readerSessionDidBecomeActive(_ session: NFCNDEFReaderSession) { debugPrint("NFC session become active======") } func readerSessionDidInvalidate(_ session: NFCNDEFReaderSession) { debugPrint("NFC session invalidate======") } func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) { print(error) } func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) { for message in messages { for record in message.records { print("Type name format: \(record.typeNameFormat)") print("Payload: \(record.payload)") print("Type: \(record.type)") print("Identifier: \(record.identifier)") } } } /// - Tag: processingNDEFTag /// if This method is not implement then only func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) will call /// Tells the delegate that the session detected NFC tags with NDEF messages and enables read-write capability for the session. func readerSession(_ session: NFCNDEFReaderSession, didDetect tags: [NFCNDEFTag]) { self.readTag(session: session, tags: tags) } }
1
0
616
Nov ’24
Apple Maps really sluggish
After upgrading to iOS 18.1, apple maps is really slow. I thought it was the app so I switched to google maps and same issue. I have tried all (including reseting the iPhone) but it did not fix it. I had iPhone 15 proMax, but since nothing worked, I upgraded to i16 but .... nothing. Any idea on how to get it fixed?
1
0
532
Nov ’24
Wallet is not highlighting boarding pass changes
Hi, I'm making changes in boarding pass through my webService and I changing Seat information but Wallet is not highlighting this information. Am I doing wrong? What do I need to do? Do need I inform anything? The request I do to silent push notification: apns-priority: 5 apns-topic: pass.**** apns-push-type: background { "aps": { "content-available": "1" } } Images links (before/after changes) https://ibb.co/0sPkbSZ https://ibb.co/rZR1jcC https://ibb.co/BCZKF1h https://ibb.co/zxQNGWW
0
0
292
Nov ’24
incomplete route data in Apple Health
When we upload workout data to HealthKit the route information with the workout detailed data is incomplete: just a few dots. When we select "Show all workout routes" the route data for the same workout shows correctly. We use the HKWorkoutBuilder to store the workout data, and add the location data with the HKWorkoutRouteBuilder to the workout with Is this an Apple Health issue, or do we have to change something in the way we store the location data to the workout?
1
0
262
Nov ’24
SwiftData: Model Container fails completely when CloudKit storage is full
struct ModelContainerSetup { static let shared = ModelContainerSetup() private static let containerIdentifier = "iCloud.Journal" func setupModelContainer() -> ModelContainer { let schema = Schema([User.self]) let modelConfiguration = ModelConfiguration( schema: schema, isStoredInMemoryOnly: false, cloudKitDatabase: .private(Self.containerIdentifier) ) do { return try ModelContainer(for: schema, configurations: [modelConfiguration]) } catch { fatalError("Could not create ModelContainer: \(error)") } } **Expected Behavior: ** When CloudKit storage is full, the app should continue functioning with local storage Data should persist locally even if cloud sync fails Sync should resume when storage becomes available **Actual Behavior: ** ModelContainer initialization fails completely Local data also stops getting saved **Environment: ** iOS 17.0+ SwiftData Private CloudKit database Ideal Behaviour: When iCloud fails, the data should still be saved locally. I do not want to have two different containers so that I can maintain data consistency.
0
0
509
Nov ’24
Testflight app cannot load the widgets
It is a very strange situation I am suffering now. I am hosting thingsboard CE on AWS EC2 (443, 1883, 80 and 8080 port are opened), I can access the console GUI through domain name, public IP and my ESP32 device can register and report MQTT data, all the widgets everything work like a charm ! I can use Simulator (iPhone 16 Plus Max) to access the dashboard, widgets, alarms, devices and audit logs, and I can install the Runner on my iPhone 16 Plus Max through Xcode and the Runner works well as expected on the Simulator. Whereas, when I created Testflight app, download and install the testing release in on my iPhone, I can access the GUI, see the dashboard, but after click the dashboard, all widgets cannot be loaded, thingsboard icon continues spinning ! The alarms, devices and audit logs on the Testflight app works well, no issues. Did you ever experience such issue? Thanks !
0
0
159
Nov ’24