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

App cannot fetch any resource after a while
Hi everyone, We came an issue that, In some scenarios in our app we cannot fetch any resources from device (Photo and Contact). One case we catched is putting app in background and spending time in other commonly used apps and coming back to our app cause this issue but there is a small chance that get this issue during using the application. In cell, we are trying to fetch the image like this imageFetchTask = Task { let image = await CompositionRoot.shared.photosManager.image(requestType: .imageCollections, forId: photoAsset.photoId) self.photoImageView.image(image) } and inner layers of this code we get the PHAsset and request image PHAsset.firstAsset(for: id) let manager = PHImageManager.default() manager.requestImage(for: asset, targetSize: request.targetSize, contentMode: .aspectFill, options: request.options) { (image, info) in continuation.resume(returning: image) } We figured out that issue not happening only in Photos also Contacts and any web request. So any help according to this situation is well appreciated. Thanks
0
0
459
Dec ’24
iOS Phone app bug: Long verdict text incorrectly truncated on call details screen
I've discovered a bug in the Phone app on iOS related to how long verdicts are displayed. When a call is identified by a third-party Caller ID app, long verdicts display correctly during the call (they auto-scroll) and in the call log (with an ellipsis at the end). However, on the call details screen, the text is strangely truncated - showing only the beginning of the string and the last word. For testing, I used this verdict: "Musclemen grow on trees. They can tense their muscles and look good in a mirror. So what? I'm interested in practical strength that's going to help me run, jump, twist, punch." I'll attach a screenshots demonstrating the problem:
0
0
271
Mar ’25
App built with Xcode 16.2 is greater then 100 mb vs the app built with Xcode 15.4
I have an app written in swift. It has multiple pods dependencies installed. When the app is generated with Xcode 15.4 the size of app is ~148Mb and when the same app is generated with Xcode 16.2 the size is ~246MB When I extracted and analysed the app, it was observed that one of the framework installed via pods Dependencies("DocumentReaderCore") was consuming more size(42.9 MB vs 215 MB) the DocumentReaderCore present in the Payload/.app/Frameworks/DocumentReaderCore.framework/DocumentReaderCore was of type linux executable when generated using Xcode 15.4 vs the other was od document type and size was 215MB.
1
0
514
Dec ’24
Live Caller ID Lookup & PIRService blocking inconsistent
I've successfully started the Live Caller ID Lookup example and initialized the PIRService. I added several identities to the input.txtpb file, some with block: true and others with block: false. Here is the file but modified phone digits: identities { key: "+40790123123" value { name: "Blocking 1" cache_expiry_minutes: 7 block: true } } identities { key: "+972526111111" value { name: "Blocking 2" cache_expiry_minutes: 7 block: true } } identities { key: "+123" value { name: "Adam" cache_expiry_minutes: 8 block: false category: IDENTITY_CATEGORY_PERSON } } identities { key: "+972526111112" value { name: "Identified Business Name 1" cache_expiry_minutes: 1 block: false category: IDENTITY_CATEGORY_BUSINESS } } identities { key: "+972526111113" value { name: "Identified Business Name 2" cache_expiry_minutes: 1 block: false category: IDENTITY_CATEGORY_BUSINESS } } The main issue is that only the number marked as +40790123123 was actually blocked, while "Blocking 2" appeared as identified contacts with their assigned name displayed. Notably, the only blocked number was a foreign number with a different country code than the number being called. The other numbers belonged to the same country. Can someone clarify whether this is a bug in the example project or an issue with the data file?
1
0
268
Mar ’25
Problem with DeviceActivitySchedule and DeviceActivityMonitor
Hey, I’m having some issues with DeviceActivitySchedule and DeviceActivityMonitor. I want to create a schedule that blocks apps (by family control) when it starts. However, even when the schedule is supposed to start on this iPhone, nothing happens, and no logs are being recorded main target: // TestView_.swift // Sloth // // Created by on 11/01/2025. // import SwiftUI import DeviceActivity import FamilyControls import ManagedSettings struct TestView_: View { var body: some View { VStack(spacing: 20) { Text("Test DeviceActivityMonitor") .font(.title) Button("Start test mon") { let now = Date() let start = Calendar.current.date(byAdding: .minute, value: 2, to: now)! let end = Calendar.current.date(byAdding: .minute, value: 20, to: now)! print("thd") DeviceScheduleTester().scheduleTestActivity(startDate: start, endDate: end) } } .padding() } } extension DeviceActivityName { static let daily = DeviceActivityName("daily") } DeviceActivityMonitor: class DeviceScheduleTester { private let center = DeviceActivityCenter() func scheduleTestActivity(startDate: Date, endDate: Date) { let calendar = Calendar.current let startComponents = calendar.dateComponents([.hour, .minute], from: startDate) let endComponents = calendar.dateComponents([.hour, .minute], from: endDate) // Tworzymy schedule let schedule = DeviceActivitySchedule( intervalStart: startComponents, intervalEnd: endComponents, repeats: true ) do { try center.startMonitoring(.daily, during:schedule) print("startMonit /(\(schedule))") } catch { print("ghfgh") } } } struct TestView__Previews: PreviewProvider { static var previews: some View { TestView_() } } DeviceActivityMonitor target: // BlockingAppsMonitorExtension // // Created by on 10/01/2025. import DeviceActivity import FamilyControls import ManagedSettings import os let logger = Logger() public class BlockingAppsMonitor: DeviceActivityMonitor { private let store = ManagedSettingsStore() public override func intervalDidStart(for activity: DeviceActivityName) { super.intervalDidStart(for: activity) print("Rozpoczęcie interwału blokowania \(activity.rawValue)") logger.info("intervalDidStart") startBlocking() } public override func intervalDidEnd(for activity: DeviceActivityName) { super.intervalDidEnd(for: activity) print("Zakończenie interwału blokowania \(activity.rawValue)") logger.info("intervalDidend") stopBlocking() } @discardableResult private func startBlocking() -> Int { print("number of unique apps") return 51 store.shield.applicationCategories = .all() // return exceptions.count } private func stopBlocking() { store.shield.applicationCategories = nil store.shield.applications = nil } } INB4: In both files are added family controls Secent file is added in DeviceActivityMonitor target. Apple answer please?
1
0
508
Jan ’25
Text To Speech does not work on Iphone 12 simulator
I'm writing an app that uses text to speech. On the physical Iphone 12 it works but on the simulator I don't get any speech from my app. I tried the following to enable. Settings -> Accessebility -> "Spoken Content" -> "Speak Selecton" to ON (green) in Voices I added the German Anna that I use on my Iphone with the downloaded enhancements. The speech test works in this menu but not in my app. What am I missing ? Cheers, Gerhard
2
0
992
Jan ’25
detect FamilyControlsMember type without requesting authorization
I have an iOS app that installs a Content Filter in order to block certain types of content at the network/socket level. The Family Controls framework stipulates that this can only be done successfully on a FamilyControlsMember.child account type (or on a supervised device). Our initial release has been really successful, but I would say that perhaps 75% of our users are .individual (probably over 18). Perhaps a topic for another forum post is to discuss how Apple's policy here doesn't seem to be meeting a real need here for non-minors, but I'll leave that alone for now. The problem we're facing is that as far as I can tell, the only way to determine if someone has the right account type is to initiate an authorization request using AuthorizationCenter.shared.requestAuthorization(for:) and then inspect the error. I think it could really help the usability of the app if we could detect the account type and preemptively show a helpful message if the authorization could not succeed, and recommend some alternatives. But I've looked so far in vain for some way to do this. Is there any api in Family Controls (or elsewhere) that can query the system for this information? Any pointers would be greatly appreciated!
0
0
255
Dec ’24
how can i get the LiveCommunicationKit events
i have codes looks like: import UIKit import LiveCommunicationKit @available(iOS 17.4, *) class LiveCallKit: NSObject, ConversationManagerDelegate { @available(iOS 17.4, *) func conversationManager(_ manager: ConversationManager, conversationChanged conversation: Conversation) { } @available(iOS 17.4, *) func conversationManagerDidBegin(_ manager: ConversationManager) { } @available(iOS 17.4, *) func conversationManagerDidReset(_ manager: ConversationManager) { } @available(iOS 17.4, *) func conversationManager(_ manager: ConversationManager, perform action: ConversationAction) { } @available(iOS 17.4, *) func conversationManager(_ manager: ConversationManager, timedOutPerforming action: ConversationAction) { } @available(iOS 17.4, *) func conversationManager(_ manager: ConversationManager, didActivate audioSession: AVAudioSession) { } @available(iOS 17.4, *) func conversationManager(_ manager: ConversationManager, didDeactivate audioSession: AVAudioSession) { } @objc public enum InterfaceKind : Int, Sendable, Codable, Hashable { /// 拒绝/挂断 case reject /// 接听. case answer } var sessoin: ConversationManager var callId: UUID var completionHandler: ((_ actionType: InterfaceKind,_ payload: [AnyHashable : Any]) -> Void)? var payload: [AnyHashable : Any]? @objc init(icon: UIImage!) { let data:Data = icon.pngData()!; let cfg: ConversationManager.Configuration = ConversationManager.Configuration(ringtoneName: "ring.mp3", iconTemplateImageData: data, maximumConversationGroups: 1, maximumConversationsPerConversationGroup: 1, includesConversationInRecents: false, supportsVideo: false, supportedHandleTypes: Set([Handle.Kind.generic])) self.sessoin = ConversationManager(configuration: cfg) self.callId = UUID() super.init() self.sessoin.delegate = self } @objc func toIncoming(_ payload: [AnyHashable : Any], displayName: String,actBlock: @escaping(_ actionType: InterfaceKind,_ payload: [AnyHashable : Any])->Void) async { self.completionHandler = actBlock do { self.payload = payload self.callId = UUID() var update = Conversation.Update(members: [Handle(type: .generic, value: displayName, displayName: displayName)]) let actNumber = Handle(type: .generic, value: displayName, displayName: displayName) update.activeRemoteMembers = Set([actNumber]) update.localMember = Handle(type: .generic, value: displayName, displayName: displayName); update.capabilities = [ .playingTones ]; try await self.sessoin.reportNewIncomingConversation(uuid: self.callId, update: update) try await Task.sleep(nanoseconds: 2000000000); } catch { } } } i want to listen the button event,but i can't find the solutions!please give me a code demo
0
0
175
Mar ’25
Is it possible to connect a single third party UWB device (hardware or chip) to multiple iPhones at the same time?
Dear fellow iOS developers, I am interested in UWB technology and I am trying to build a dummy Indoor Navigation project. I will be placing 3 third party UWB devices (hardware or chips) at some distance apart from each other. I have 5 iPhones and I want to be able to connect all the 5 iPhones to the 3 UWB devices simultaneously and perform trilateration to get the iPhones x and y coordinates using the "distance" values obtained from the UWB devices (hardware or chips). I have tried this approach using Qorvo DWM3000 chips but problem is that after the first iPhone connection, the chip stops advertising itself. Is this approach possible? Also, it is compulsory to establish NISessions? Can't I skip creating NISessions? Thanks in advance. Forgive my english.
0
0
344
Dec ’24
Possible to access CoreData/Persistent storage from DeviceActivityReportExtension?
This is more a general question of whether it is possible to share persistent/coredata from the main app to Screentime-related extensions such as DeviceActivityReportExtension. I've set my code up (e.g., App Groups, files to different targets, using nspersistentcontainer with app group url, etc.) in a way that it builds, and the extension seems to recognize my CoreData schema (able to query using fetchrequest). But the data returned is always null. So i'm wondering if it is even possible to READ app data from the extension. I understand it is not possible to write or pass data from the extension back to the app. I've also been able to read data that was saved in main app from UserDefaults in my extension.
0
0
428
Dec ’24
Namedrop style AirDrop is not working.
PLATFORM AND VERSION Xcode Version 16.2 beta 3 (16C5023f) macOS 15.1.1 (24B91) Run-time configuration: iOS 18.0 DESCRIPTION OF PROBLEM We are currently testing the functionality of AirDrop by bringing iPhones close to each other. I am trying to transfer the activityItemsConfiguration set in the modal screen via AirDrop. However, if presentationStyle is fullscreen, it succeeds, but otherwise the connection is successful but no item is displayed on the screen. STEPS TO REPRODUCE Open my project. Run on device Tap Present with toggle is off. ModalViewController presented as sheet. Bring another iPhone closer Play connection animation, then just display connected.
1
0
445
Dec ’24
macOS ImageCaptureCore does not recognise scanners
Hi All, I would like to develop a small macOS app using swift. I want to use ImageCaptureCore to access and control connected scanners ( via usb). I followed the official docs and wrote this ScannerManager. The code seems to be working without issues or warnings. I added the Hardened Runtime capability and both com.apple.security.personal-information.photos-library and com.apple.security.device.usb to the .entitlements file. As well added NSCameraUsageDescription to the Info.plist. Problem: None of my scanners do get detected (tested 2 different models). Of course, they are connected and do get recognized by the Image Capture App (and work as expected) and are listed in the systems app, too. When I connect my phone it does get detected by the func deviceBrowser(_ browser: ICDeviceBrowser, didAdd... delegate function. Thats why I believe my code is working but the app is lacking permissions to detect scanners somehow. Does anyone know something about this? I am using macOS 15.1.1 (24B91) on a M1 Pro. Many thanks in advance! class ScannerManager: NSObject, ICDeviceBrowserDelegate, ICDeviceDelegate { let deviceBrowser: ICDeviceBrowser private var currentDevice: ICDevice? private var scannerDeviceDelegate: ScannerDeviceDelegate? var isScanning = false var scanners: [ICDevice] = [] // MARK: - Initialization override init() { print("🚀 Initializing ScannerManager...") self.deviceBrowser = ICDeviceBrowser() super.init() self.deviceBrowser.delegate = self // Log the initial browsed device type mask self.deviceBrowser.browsedDeviceTypeMask = .scanner print("🔍 Starting device browser...") self.deviceBrowser.start() // Enhanced device logging if let devices = deviceBrowser.devices { print("\n📱 Connected devices overview:") print("Total devices found: \(devices.count)") if devices.isEmpty { print("⚠️ No devices currently connected") } else { devices.forEach { device in print("\n📌 Device Details:") print(" - Name: \(device.name ?? "unnamed")") print(" - Type: \(String(describing: device.type))") print(" - Transport Type: \(String(describing: device.transportType))") print(" - Status: \(device.hasOpenSession ? "In Use" : "Available")") print(" - Persistent ID: \(String(describing: device.persistentIDString))") print(" - Location: \(device.locationDescription ?? "Unknown")") print(" - Capabilities: \(String(describing: device.capabilities))") } } } else { print("⚠️ Unable to access device list") } } ...
0
0
151
Dec ’24
Intermittent App Package Installation failure.
I work on a macOS application that functions as a daemon. To test it, I: Compile executables. Use pkgbuild and productbuild to build an application bundle. Use codesign and notarytool to sign and notarize the app. Install the app with /usr/sbin/installer -target LocalSystem -pkg .... This often overwrites the previous version of the app. Sometimes, the installation fails at the postinstall stage, when it can not find the application's install directory. We explicitly check for this error in our script: if ! [ -d "$APP_INSTALL_DIR"/Contents ]; then echo "directory ${APP_INSTALL_DIR}/Contents is missing" exit 1 fi This is unexpected! Even worse, some of our customers have occasionally seen the same issue! We use a postinstall script in order to install files into the /Library/LaunchDaemons and /Library/ LaunchAgents directories, and start the agent with launchctl bootstrap. Our preinstall script makes sure that the previous version of our application is fully uninstalled (so there is no confusion), and we wonder if that is part of the problem. While researching this error, I ran across a discussion of a similar issue on Stackoverflow: <https:// stackoverflow.com/questions/19283889>. One of the commenters there wrote: It appears that the OS X installer uses information about already installed packages and application bundles in order to decide where and if to install new packages. As a result, sometimes my installer did not install any files whatsoever, and sometimes it just overwrote the .app bundle in my build tree. Not necessarily the one used to build the installer, but any .app bundle that OS X had found. In order to get the installer to install the files properly I had to do two things: Tell OS X to forget about the installed package. sudo pkgutil --forget <package id> Not sure if this is needed for you nor in my case, but it is probably a good idea anyway. Delete all existing .app bundles for the app. If I didn't do this, the existing app bundle was overwritten on install instead of the app being placed in /Applications. Maybe there is a way to prevent this while building the installer package, but I haven't found it. On the other hand, the man page for pkgutil says not to use --forget from an installer: Discard all receipt data about package-id, but do not touch the installed files. DO NOT use this command from an installer package script to fix broken package design. What is the correct approach to fix this problem?
5
0
590
Dec ’24
Evidently I'm not generating API tokens right.
I'm trying (in Swift) to use CryptoKit to generate the required JWT for the Apple Music Web API, as documented (sort of) here. But I'm getting 401s no matter what I try. I found some examples of generating JWTs online, but something isn't working here. I've set up my identifiers and gotten an API secret through my account in the dev portal. It's associated with an identifier requesting Music API access (I requested all three available Music-related capabilities). For the secret, I'm using the long key string from the .p8 file I generated and downloaded from the dev portal. Here's what I've tried: struct APIToken { struct Header: Encodable { let alg = "HS256" let kid: String } struct Payload: Encodable { let iss: String let iat: String let exp: String } static func tokenize(keyID: String, issuerID: String, secret: String) -> String { let privateKey = SymmetricKey(data: Data(secret.utf8)) let headerJSONData = try! JSONEncoder().encode(Header(kid: keyID)) let headerBase64String = headerJSONData.base64EncodedString() let currUnixTime = Int(Date().timeIntervalSince1970) let expUnixTime = currUnixTime + 5 * 2628288 // five months of seconds let payloadJSONData = try! JSONEncoder().encode(Payload(iss: issuerID, iat: "\(currUnixTime)", exp: "\(expUnixTime)")) let payloadBase64String = payloadJSONData.base64EncodedString() let toSign = Data((headerBase64String + "." + payloadBase64String).utf8) let signature = HMAC<SHA256>.authenticationCode(for: toSign, using: privateKey) let signatureBase64String = Data(signature).base64EncodedString() let token = [headerBase64String, payloadBase64String, signatureBase64String].joined(separator: ".") print(token) return token } } I also tried making sure the base64 strings are URL-safe with this extension: extension Data { func URLSafeBase64EncodedString() -> String { return base64EncodedString() .replacingOccurrences(of: "+", with: "-") .replacingOccurrences(of: "/", with: "_") .replacingOccurrences(of: "=", with: "") } } but that made no difference. All the documentation says is A decoded developer token has the following format. { "alg": "ES256", "kid": "ABC123DEFG" } { "iss": "DEF123GHIJ", "iat": 1437179036, "exp": 1493298100 } After you create the token, sign it with your MusicKit private key using the ES256 algorithm. Am I not doing that? Any insight appreciated.
0
0
487
Nov ’24
Issue with UWB ranging on DWM3001CDK using NINearbyAccessoryConfiguration in Background mode
Hi, I’m trying to perform UWB ranging between an iPhone and a Qorvo DWM3001CDK accessory using Apple NI’s NINearbyAccessoryConfiguration class. I’ve followed the steps described in the official Apple documentation (https://developer.apple.com/documentation/nearbyinteraction/ninearbyaccessoryconfiguration), specifically for enabling background mode using the init(accessoryData:bluetoothPeerIdentifier:) initializer. The configuration is successfully created, and background mode is enabled. However, when the iPhone starts the session, I doesn’t receive any ranging data from the DWM3001CDK, and the session ends with a timeout. Interestingly, if I use the init(data:) initializer, I can successfully receive ranging data, but this only works in foreground mode, which doesn’t meet my requirements. Steps I’ve followed: Used Core Bluetooth to discover and pair the accessory. Retrieved the configuration data from the accessory according to the third-party UWB device specifications. Initialized the configuration using NINearbyAccessoryConfiguration(accessoryData:bluetoothPeerIdentifier:) for background mode. Started the session with NISession.run(configuration). Waited for updates in the delegate method session(_:didUpdate:). Specific questions: Are there additional requirements for using init(accessoryData:bluetoothPeerIdentifier:) to enable background UWB ranging with the DWM3001CDK? Is there a known difference in how init(data:) and init(accessoryData:bluetoothPeerIdentifier:) handle the ranging process? Any advice or insights would be greatly appreciated. Thanks in advance!
1
0
403
Mar ’25
App Store Review always got 4.3 for my apps
I created an app and submitted to app store for review and got a rejection with "4.3(a) - Design - Spam". This one was created for brand new, and I didn't find any similar apps in App store. I searched in this forum but am not sure if it is because I used flutter to build my app? How could I get a bit more specific detail why it got rejected? Guideline 4.3(a) - Design - Spam We noticed your app shares a similar binary, metadata, and/or concept as apps submitted to the App Store by other developers, with only minor differences. Submitting similar or repackaged apps is a form of spam that creates clutter and makes it difficult for users to discover new apps. Next Steps Since we do not accept spam apps on the App Store, we encourage you to review your app concept and submit a unique app with distinct content and functionality.
0
0
305
Dec ’24
WeatherKit - hourly temperature details
we’re looking to get some clarification around how the hourly forecasts should be interpreted to ensure we’re using your data in the correct manner. If you could provide the answers to the following questions would be extremely helpful: 1. What do the data points (e.g temperature) in the hourly forecast represent for a future hour? Do they represent the expected average over that future hour or do they represent the forecast for the point in time at the top of the hour? 2. What do those same data points represent in the hourly forecast for an hour which has already begun? e.g. it’s 8:30 and we pull the hourly forecast and the 8:00 hour is still returned. Which of the following would be the correct interpretation for the values returned for the 8:00 hour: The values represent the forecast for the point in time at the top of the 8:00 hour (if this is the case we would expect it to stop updating) The values represent the current forecast i.e. what the weather is right now The values represent the average over the remaining portion of the 8:00 hour The values represent the average over the full 8:00 hour including both the portion which has already elapsed and the portion which is still to come 3. What does the data represent after the hour (i.e. looking at historical hours)? Is it: The last forecast made within the hour? If so, is that point-in-time or average for the hour (as explained above)? The actual weather for that hour (using some non-forecast measure of real weather)? If so, again is that point-in-time at top of hour / point-in-time at end of hour / average over the hour?
2
0
239
Mar ’25
iOS 18.0 and above systems, Control Center Video Effects bug
我的app不是VOIP应用,使用iPad10或者iPad13.18等支持人物居中的设备,系统是iOS18.0,18.1或者18.1.1,进入直播课中,控制中心不显示"人物居中"按钮,必现的,如下图。但是项目中Background Modes勾选Voice over IP,再次运行app,就不会再复现,即便是卸载重装也不会再复现。麻烦帮忙看看什么原因?谢谢
0
0
365
Nov ’24
Live caller id lookup onboard appstore
I have been working to implement Apple's Live Caller ID feature, which requires setting up a relay server. Following Apple's guidelines, I submitted a request through the provided link to utilize Apple's relay server. However, it's been three weeks, and I have yet to receive a response. I contacted Apple Support, but they indicated that this is a technical matter beyond their scope.​ Has anyone successfully received confirmation from Apple regarding the use of their relay server for Live Caller ID? If so, could you share your experience or any advice on how to proceed? url: https://developer.apple.com/contact/request/live-caller-id-lookup/ Thank you.
2
0
318
Mar ’25