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.

Posts under General subtopic

Post

Replies

Boosts

Views

Activity

Filtered dataFrame displays original dataFrame values
I'm importing a csv file of 299 rows and creating a subset by filtering on one column value (24 rows). I want to Chart just the filtered values. However, when I print one column I get values from the original dataFrame. Any suggestions? Thanks, David The code: import SwiftUI import Charts import TabularData struct DataPoint: Identifiable { var id = UUID() // This makes it conform to Identifiable var date: Date var value: Double } struct ContentView: View { @State private var dataPoints: [DataPoint] = [] var body: some View { Text("Hello") Chart { ForEach(dataPoints) { dataPoint in PointMark( x: .value("Date", dataPoint.date), y: .value("Value", dataPoint.value) ) } } .frame(height: 300) .padding() .onAppear(perform: loadData) } func loadData() { print("In Loading Data") // Load the CSV file if let url = Bundle.main.url(forResource: "observations", withExtension: "csv") { do { let options = CSVReadingOptions(hasHeaderRow: true, delimiter: ",") var data0 = try DataFrame(contentsOfCSVFile: url, options: options) let formattingOptions = FormattingOptions( maximumLineWidth: 200, maximumCellWidth: 15, maximumRowCount: 30 ) // print(data0.description(options: formattingOptions)) print("Number of Columns: \(data0.columns.count)") let columnsSet = ["plant_id", "date", "plot", "plantNumber", "plantCount"] data0 = try DataFrame(contentsOfCSVFile:url, columns: columnsSet, options: options) print("Number of Columns (after columnsSet): \(data0.columns.count)") print("Printing data0") print(data0.description(options: formattingOptions)) let data = data0.filter { $0["plant_id"] as? Int == 15 } print("Printing data") print(data.description(options: formattingOptions)) print(" Number of Rows \(data.rows.count)") for i in 0 ... data.rows.count { // print("\(i): \(data["plantCount"][i]!)") if let plantCount = data["plantCount"][i] as? Int { print("\(i): \(plantCount)") } else { print("\(i): Value not found or invalid type") } } // // var newDataPoints: [DataPoint] = [] // Here I plan to add the filtered data to DataPoint // DispatchQueue.main.async { dataPoints = newDataPoints } } catch { print("Error reading CSV file: \(error)") } } else { print("Didn't load csv file") } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } Here is the new dataFrame and print output Printing data ┏━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━┓ ┃ ┃ plant_id ┃ date ┃ plot ┃ plantNumber ┃ plantCount ┃ ┃ ┃ <Int> ┃ <String> ┃ <Int> ┃ <Int> ┃ <Int> ┃ ┡━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━┩ │ 0 │ 15 │ 2023-09-07 │ 1 │ 5 │ 5 │ │ 32 │ 15 │ 2023-09-07 │ 2 │ 10 │ 10 │ │ 38 │ 15 │ 2023-09-07 │ 2 │ 20 │ 20 │ │ 66 │ 15 │ 2023-09-07 │ 4 │ 25 │ 25 │ │ 77 │ 15 │ 2023-09-07 │ 5 │ 5 │ 5 │ │ 99 │ 15 │ 2023-09-14 │ 7 │ 45 │ 45 │ │ 142 │ 15 │ 2024-05-30 │ 1 │ 20 │ 20 │ │ 162 │ 15 │ 2024-05-30 │ 4 │ 5 │ 5 │ │ 169 │ 15 │ 2024-05-30 │ 5 │ 10 │ 10 │ │ 175 │ 15 │ 2024-05-30 │ 7 │ 10 │ 10 │ │ 188 │ 15 │ 2024-07-11 │ 1 │ 20 │ 40 │ │ 199 │ 15 │ 2024-07-11 │ 2 │ 5 │ 5 │ │ 215 │ 15 │ 2024-07-11 │ 5 │ 20 │ 30 │ │ 220 │ 15 │ 2024-07-11 │ 7 │ 30 │ 40 │ │ 236 │ 15 │ 2024-09-06 │ 1 │ 20 │ 60 │ │ 238 │ 15 │ 2024-09-06 │ 2 │ 30 │ 35 │ │ 248 │ 15 │ 2024-09-06 │ 5 │ 5 │ 35 │ │ 254 │ 15 │ 2024-09-06 │ 7 │ 50 │ 90 │ │ 267 │ 15 │ 2025-05-04 │ 1 │ 10 │ 70 │ │ 273 │ 15 │ 2025-05-04 │ 2 │ 10 │ 45 │ │ 282 │ 15 │ 2025-05-04 │ 5 │ 10 │ 45 │ │ 287 │ 15 │ 2025-05-04 │ 7 │ 30 │ 120 │ │ 292 │ 15 │ 2025-05-04 │ 8 │ 10 │ 0 │ │ 297 │ 15 │ 2925-05-04 │ 3 │ 10 │ 0 │ └─────┴──────────┴────────────┴───────┴─────────────┴────────────┘ 24 rows, 5 columns Number of Rows 24 0: 5 1: 80 2: 1 3: 1 4: 1 5: 3 6: 3 7: 1 8: 6 9: 1 10: 1 11: 1 12: 1 13: 10 14: 50 15: 1 16: 2 17: 1 18: 3 19: 8 20: 5 21: 3 22: 7 23: 2 24: 1
2
0
63
May ’25
Live Lookup flow stuck at /issue/token-key-for-user-token endpoint
Hi Apple engineering team, I’m trying to integrate the new Live Caller ID Lookup (PIR) on iOS using your pir-service-example code as well as a custom mock server in Vapor, but the extension never advances past the /issue/token-key-for-user-token step. I’ve tried both: 1. Official Example Cloned https://github.com/apple/pir-service-example Ran PIRService locally Confirmed that GET /.well-known/private-token-issuer-directory → 200 GET /issue/token-key-for-user-token → 200 (DER bytes, correct SPKI) No POST /issue ever fires 2. Mock Server (Vapor) Implemented all five endpoints (/config, /.well-known/private-token-issuer-directory, /issue/token-key-for-user-token, /issue, /queries) Verified with curl and openssl asn1parse that: GET /.well-known/private-token-issuer-directory Content-Type: application/private-token-issuer-directory { "issuer-request-uri":"https://…/issue", "token-keys":[…] } GET /issue/token-key-for-user-token Content-Type: application/octet-stream &lt;DER bytes&gt; Added Cache-Control: public, max-age=3600 on directory and SPKI Stubbed POST /issue to always return { "token": "" } Still no POST /issue request from the extension Reproduction Steps Install and enable a Live Lookup extension pointing to my server. Trigger an incoming call on device. Watch server logs—only see the two GETs, never /issue or /queries. Expected Behavior After fetching the SPKI DER, the framework should issue a POST /issue call (Privacy Pass flow) and then POST /queries. Observed Behavior Stuck in an infinite loop of: GET /.well-known/private-token-issuer-directory GET /issue/token-key-for-user-token (repeat…) No progression to the /issue or /queries endpoints. What I’ve Tried Verified JSON kebab-case and headers exactly match examples Confirmed SPKI DER is valid via openssl asn1parse Added Cache-Control headers Tested on real device, localhost url, and ngrok public URL Mocked a valid-looking token response Could you advise what additional requirement or format detail I’m missing that prevents from advancing past /issue/token-key-for-user-token? These are the main files: LiveLookupExtension.swift routes.swift service-config.json Thanks in advance!
0
0
57
May ’25
How can I access app usage data from other apps in iOS?
Hi, I’m developing an iOS application and want to explore if there are any official methods available to monitor or retrieve information about the usage patterns of other apps installed on a user’s device — such as launch time, duration of use, or app switching behavior. I understand Apple enforces strict privacy policies. My question is: Are there any APIs or frameworks (public or private) that allow reading app usage data from other apps? Can Screen Time or DeviceActivityReport frameworks be leveraged for such use? Would an app like this be eligible for App Store approval, or would it require special entitlements? My intent is not to violate privacy, but to explore if Apple allows any of this under Screen Time APIs or family usage scenarios. Any insights or guidance would be appreciated! Thanks, [Your Name]
1
0
58
May ’25
Live Caller ID Lookup: OHTTP Gateway Rejection
Hello, After submitting onboarding form for Live Caller ID Lookup feature, we received rejection response that our OHTTP gateway doesn't support HTTP/2. We have run provided command openssl s_client -alpn h2 -connect with our domain several times from different machines and environments, and our results consistently confirm that HTTP/2 is indeed supported by our OHTTP gateway. The output clearly shows ALPN protocol: h2, indicating successful HTTP/2 negotiation. Here is the log chunk from the command-line response: No client certificate CA names sent Peer signing digest: SHA256 Peer signature type: RSA-PSS Server Temp Key: X25519, 253 bits --- SSL handshake has read 4393 bytes and written 406 bytes Verification: OK --- New, TLSv1.3, Cipher is TLS_AES_128_GCM_SHA256 Server public key is 2048 bit This TLS version forbids renegotiation. Compression: NONE Expansion: NONE ALPN protocol: h2 Early data was not sent Verify return code: 0 (ok) --- DONE We have also tried different 3rd-party services to check the HTTP/2 support and they also confirmed that HTTP/2 is supported. Is it possible to provide additional details on the specific criteria or test conditions that led to its non-approval? I'm happy to provide any further diagnostic information or engage in more detailed technical discussion.
1
7
114
May ’25
Screen Time API: How to map bundleIdentifier to ApplicationToken for DeviceActivityMonitor when FamilyActivitySelection.Application.bundleIdentifier is nil?
I'm using FamilyActivityPicker to get consent for app/category management, which returns a FamilyActivitySelection object. I serialize this FamilyActivitySelection object (just applicationTokens and categoryTokens) and pass it to my DeviceActivityMonitor extension via App Group UserDefaults. I am using the JSON encoder/decoder over PropertyList (though both seem to exhibit the same behavior). After inspecting the FamilyActivitySelection object immediately after it's returned by FamilyActivityPicker in the main app, the application.bundleIdentifier property is consistently nil for every Application object within selection.applications. Similarly, category.localizedDisplayName is nil for ActivityCategory objects. This happens whether "Select All Apps" is used or if apps/categories are selected individually. I understand that this is the intended behavior due to Apple's user privacy policies. I read on another post that my app can be provided with bundle identifiers and app names within Shield Configuration extensions and Device Activity Report extensions - I'm not sure which ones or how exactly to do this. I am aware that I can use Label(applicationToken) SwiftUI view to display the app name/icon, but this doesn't give programmatic access to the bundleIdentifier string. My app will not log or export these bundleIdentifiers outside of its sandbox. My goal is to create mappings to the FamilyActivitySelection with the publicly accessible bundleIdentifiers. Any guidance, examples, or clarification on the intended workflow for this scenario would be greatly appreciated!
0
0
93
May ’25
Clarification on ManagedSettings Shield Precedence (Application vs. Category)
I'm encountering what appears to be a specific precedence behavior with ManagedSettingsStore.shield and would appreciate some further clarification. My current understanding is that category-level shields take precedence over individual app allowances. My test involved... Using FamilyActivityPicker to select a single target application (e.g., "Calculator," which falls under the "Utilities" category). Using FamilyActivityPicker again to select the category of that target application. I applied shields using ManagedSettingsStore (named .individual): store.shield.applicationCategories = .specific(Set([utilitiesCategoryToken])) store.shield.applications = Set([calculatorApplicationToken]) Result: The calculator app remains shielded, suggesting that the category-level shield on Utilities overrides the attempt to allow the individual app. I also tried this using a single picker, but received only the category token instead of all application tokens in that category. Is this observed precedence (where store.shield.applicationCategories effectively overrides store.shield.applications for apps within the shielded category) the intended behavior? If so, are there any mechanisms available within the main app's capabilities (potentially using a Device Activity Report Extension or Shield Extension) to allow a specific ApplicationToken if its corresponding ActivityCategoryToken is part of the store.shield.applicationCategories set? Essentially, can store.shield.applications be used to create "allow exceptions" for individual apps that fall into an otherwise shielded category? Additionally, I mentioned that selecting an entire category in the picker only returns the opaque category token, not any application tokens. Is there any way in which I could return both the category and all application tokens by just selecting the category? Any insights or pointers would be greatly appreciated!
0
0
74
May ’25
Need to check Call Status without using CallKit
My app requirement is to check that User is on call while doing transaction. If user on call then we need to show Caution alert. For this requirement we used CallKit to detect Call status and it's working fine but recently Apple has rejected the application because of Callkit that is banned in China. Could you please provide any solution to check the Call Status only.
3
0
82
May ’25
Phonetic vs Pronunciation contacts fields and Siri
The contacts app has fields for Phonetic and Pronunciation. My app adds phonetic data to the phonetic field to help Siri better understand contacts stored in Greek, Cyrillic, or Georgian. However, using the phonetic field causes the sorting order of contacts to be messed up. For example, Greek B (beta) is represented as a phonetic sound of V, resulting in a completely incorrect sorting order. The pronunciation field doesn’t seem to affect the sorting order, but I’m not sure what it does or should do. My questions are: Do we understand the difference between phonetic and pronunciation, and how Siri actively uses them? If the phonetic field is the correct one to use, how can we raise a feature request with Apple to add an option to sort contacts based on phonetic fields or not? Here’s a test you can try: Create a new contact with the following details: First name: test Last name: test Phonetic first name: Billy Phonetic last name: Idol Ask Siri to show the contact Billy Idol. It will return the “test test” contact. Switch from the phonetic to the pronunciation fields. Now, Siri won’t find Billy Idol.
5
0
76
May ’25
How can I open and write to an SQLite database from my DeviceActivityReport Extension?
Hello everyone, I’m working on an iOS app that uses the new DeviceActivity framework to monitor and report user screen‐time in an extension (DeviceActivityReportExtension). I need to persist my processed screen‐time data into a standalone SQLite database inside the extension, but I’m running into issues opening and writing to the database file. Here’s what I’ve tried so far: import UIKit import DeviceActivity import SQLite3 class DeviceActivityReportExtension: DeviceActivityReportExtension { private var db: OpaquePointer? override func didReceive(_ report: DeviceActivityReport) async { // 1. Construct path in app container: let containerURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.mycompany.myapp") let dbURL = containerURL?.appendingPathComponent("ScreenTimeReports.db") // 2. Open database: if sqlite3_open(dbURL?.path, &amp;db) != SQLITE_OK { print("❌ Unable to open database at \(dbURL?.path ?? "unknown path")") return } defer { sqlite3_close(db) } // 3. Create table if needed: let createSQL = """ CREATE TABLE IF NOT EXISTS reports ( id INTEGER PRIMARY KEY AUTOINCREMENT, date TEXT, totalScreenTime DOUBLE ); """ if sqlite3_exec(db, createSQL, nil, nil, nil) != SQLITE_OK { print("❌ Could not create table: \(String(cString: sqlite3_errmsg(db)))") return } // 4. Insert data: let insertSQL = "INSERT INTO reports (date, totalScreenTime) VALUES (?, ?);" var stmt: OpaquePointer? if sqlite3_prepare_v2(db, insertSQL, -1, &amp;stmt, nil) == SQLITE_OK { sqlite3_bind_text(stmt, 1, report.date.description, -1, nil) sqlite3_bind_double(stmt, 2, report.totalActivityDuration) if sqlite3_step(stmt) != SQLITE_DONE { print("❌ Insert failed: \(String(cString: sqlite3_errmsg(db)))") } } sqlite3_finalize(stmt) } } However: Path issues: The extension’s sandbox is separate from the app’s. I’m not sure if I can use the same App Group container, or if there’s a better location for an on‐extension database. Entitlements: I’ve added the App Group (group.com.mycompany.myapp) to both the main app and the extension, but the file never appears, and I still get “unable to open database” errors. My questions are: How do I correctly construct a file URL for an SQLite file in a DeviceActivityReportExtension? Is SQLite the recommended approach here, or is there a more “Apple-approved” pattern for writing data from a DeviceActivity extension? Any sample code snippets, pointers to relevant Apple documentation, or alternative approaches would be greatly appreciated!
1
0
82
May ’25
How to debug Quick Look Preview Extension
I'm facing the same problem as addressed in this discussion: After switching from legacy QLGenerators to Preview extensions on macOS I cannot debug the extensions' code in Xcode, anymore: I launch the app with the embedded appex from Xcode in debug mode. When trying to attach to the appex process the following error is reported: Code: 6 Failure Reason: Ensure “AppName Preview” is not already running, and matthias has permission to debug it. User Info: {... } System Information macOS Version 15.4.1 (Build 24E263) Xcode 16.3 (23785) (Build 16E140) Timestamp: 2025-05-12T14:07:14+02:00 I'm using a standard user account (no admin) and might miss some obvious steps. Can someone detail the steps to debug a Preview (or Thumbnail) extension with Xcode 16? For legacy Quick Look plugins I was using "qlmanage", but that's not working on extensions. All the best, Matthias P.S.: Pardon me re-posting my reply as a separate thread, to increase visibility, but I'm quite desperate and couldn't find any solution on the web...
1
1
83
May ’25
Unable to locate my stickers in message app after installed my app
My sticker app was rejected when I submitted it to App Store Connect. Reason: "We were unable to locate your stickers in message app after installed your app." When I checked on an iOS18 device, this was correct. However, my stickers is visible when I dragged the half-modal(like sheetPresentationController) part. I hope what I need to do to get the stickers to display initially. My code(Xcode16.2) class StickerViewController: MSStickerBrowserViewController { var stickers = [MSSticker]() override func viewDidLoad() { super.viewDidLoad() loadStickers() } override var stickerSize: MSStickerSize { get { return .small } } func loadStickers() { var imageSetPath = "en" for index in 1...20 { var strIndex = "" strIndex = "stmp" + String(index) + imageSetPath createSticker(assetLocation: "\(strIndex)", assetDescription: "\(strIndex)") } } func createSticker(assetLocation: String, assetDescription: String) { guard let path = Bundle.main.path(forResource: assetLocation, ofType: "png") else { return } let url = URL(fileURLWithPath: path) do { let sticker = try MSSticker(contentsOfFileURL: url, localizedDescription: assetDescription) stickers.append(sticker) } catch { print(error) } } } extension StickerViewController { override func numberOfStickers(in stickerBrowserView: MSStickerBrowserView) -> Int { return stickers.count } override func stickerBrowserView(_ stickerBrowserView: MSStickerBrowserView, stickerAt index: Int) -> MSSticker { return stickers[index] } }
1
0
48
May ’25
Push-to-Talk: Disable “Leave” Button in System Screen & APNs Only Triggered Once
Dear Apple Team, I have two questions regarding the Push-to-Talk framework on iOS 18: Would it be possible to disable or hide the “Leave” button in the system screen? Currently, only the “Talk” button can be disabled when using the "Listen Only" mode, but the “Leave” button remains active. It would be very helpful to have the option to control or hide this button as well, depending on the use case. At the moment, I can only detect if the user pressed the "Leave" button by checking the PTChannelLeaveReason. However, this alone is not sufficient to prevent unwanted user actions or to guide the user experience more precisely in certain scenarios. I only receive the APNs push notification “type: voip-ptt“ once per active channel. My app is running in the background, and I frequently switch between full- and half-duplex to allow users to reply immediately. After some time, even though a new notification should be triggered, no banner is shown. When I try to talk via the framework, the active speaker is correctly updated, but no notification appears. Only after leaving and rejoining the channel do I receive a new notification – and again, just once. Could you please let me know whether this is expected behavior or if it might be a bug? Thank you very much in advance. Best regards, Eugen
1
0
69
May ’25
Pushkit/Callkit with unlocked SIM before first unlock
We have a problem in a scenario that SIM lock is disabled so after a phone reboots it has the Internet connection but it is still locked. When you call into the VOIP app the app is not being launched as the result (it seems reasonable because it wouldn't be able to access the keychain items etc...) but the OS still seem to enforce the rule that the app needs to report the new incoming call. When we then unlock the app we can see no more pushkit pushes are arriving (dropped on the floor in the console) but we get the three initial pushes that were send during the locked phase right after the app launch.
4
0
134
May ’25
"Application" is accessing your screen notification
Hi! I'm developing an application based on Chrome that needs to take regular screenshots of webpages. Under the hood (actually Chromium), it uses SCScreenshotManager to capture screenshots automatically (without user interaction). I've noticed that regularly using this API triggers a user notification saying: "Your Screen 'AppTest' has accessed your screen and system audio 3,594 times in the past 30 days. You can manage this in Settings." How can I prevent this notification from appearing? Are there any specific entitlements(Or configuration of SCScreenshotManager) that I can use? Thanks!
2
0
106
May ’25
Is MetricKit automatically on all devices?
Hello Apple, I am trying to get information such as crash context whenever a user encounters a situation where the app is killed. I was wondering if the tool MetricKit is available to all users or is this a feature to those who has opted into it. I am aware that the whenever someone gets a new device or in settings, an option will appear that'll have users decide whether or not to have Apple receive data analytics during certain events on their device. Does this have any effect on whether some users may not have MetricKit? Overall, we are attempting to use MetricKit to better analyze performance of our app. It would be inefficient for us, if the population of users using MetricKit is only those who have opted into it. Thanks, dmaliro
3
0
107
May ’25
Error Domain=FamilyControls.FamilyControlsError Code=2 "(null)"
An error was reported when requesting permissions on devices with iOS 16.2 16.3. It is not an emulator. Through the log records, the following Error message appears Error Domain=FamilyControls.FamilyControlsError Code=3 "(null)" Error Domain=FamilyControls.FamilyControlsError Code=4 "(null)" Error Domain=FamilyControls.FamilyControlsError Code=5 "(null)" func requestScreenTime() async -> Bool { do { try await AuthorizationCenter.shared.requestAuthorization(for: .individual) return AuthorizationCenter.shared.authorizationStatus == .approved } catch { print("\(error)") return false } }
1
0
51
May ’25
Silly question: getting a user's email address(es)
For login purposes, we may want to try automatically checking to see if an email address is set up in certain databases. It looks like the preferred way to do this is via ABAddressBook.shared().me(), then get the right key via in the properties? This, however, is treated as accessing the whole address book and brings up a confirmation dialogue. However, as I thought about it, that might not be the real way we'd want -- we'd want to go through Active Directory, perhaps? Am I making any sense, or just being incoherent? 😄
8
0
90
May ’25
CallKit does not activate audio session with higher probability after upgrading to iOS 18.4.1
Hi, We've noticed that this issue occurs more frequently after upgrading to iOS 18.4.1 and can result in one-way audio. Our app uses CallKit with WebRTC to establish VoIP connections. However, on iOS 18.4.1, CallKit no longer triggers: func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) We're currently comparing the occurrence rate across different iOS versions to better understand the impact. Could you please help analyze the root cause of this issue?
4
0
192
May ’25