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.

Post

Replies

Boosts

Views

Activity

Universal link failing to redirect to app in special circumstances
I'm developing two native apps and one is a authentication app and other one is business app. In the main flow if buisness application is on the foreground and did nothing for at least 10 minutes it will automatically time out and redirect to the autentication app for token refresh. In this flow universal link redirect to the authetication app without opening Safari. But if i execute the below flow buissness app redirect to the Safari. Buisness App In Foregorund → Displaying a OS screen while app is in Foreground(Like Push Notification Center) → On this satate leave device for 10 minutes → Buisness app will automatically timeout and rediret to Safari(In safari 「NoSuchKey The specified key does not exist.」message is displaying but authentication app Universal link Start button is showing) → After click the Universal Link start button in Safari Authentication App open. I use the below code to start the Universal Link: if let url = URL(string: path) { UIApplication.shared.open(url) } So i would like to know is there a special reason that when Displaying a OS screen while app is in Foreground(Like Push Notification Center) affect the normal flow of Universal redirection to another app?
0
0
181
Oct ’24
CoreGraphics: CGPDFPageCopyRootTaggedNode
My app uses PDFKit, but I don't know how to solve this bug at all. Under the same IOS system and device model, some users' devices may experience crashes, while our own devices are functioning normally. The following is the stack information for crashing: 0 libsystem_platform.dylib__os_unfair_lock_recursive_abort + 36 1 libsystem_platform.dylib__os_unfair_lock_lock_slow + 308 2 CoreGraphics_CGPDFPageCopyRootTaggedNode + 56 3 PDFKit-[PDFPageViewAccessibility accessibilityElements] + 76 4 UIAccessibility-[NSObject(AXPrivCategory) _accessibilityElements] + 56 5 UIAccessibility-[NSObjectAccessibility accessibilityElementCount] + 68 6 UIAccessibility-[NSObject(AXPrivCategory) _accessibilityHasOrderedChildren] + 44 7 UIAccessibility-[NSObject(AXPrivCategory) _accessibilityFrameForSorting] + 216 8 UIAccessibility-[NSObject _accessibilityCompareGeometry:] + 116 9 UIAccessibility-[NSObject(AXPrivCategory) accessibilityCompareGeometry:] + 52 10 CoreFoundation___CFSimpleMergeSort + 100 11 CoreFoundation___CFSimpleMergeSort + 248 12 CoreFoundation_CFSortIndexes + 260 13 CoreFoundation-[NSArray sortedArrayFromRange:options:usingComparator:] + 732 14 CoreFoundation-[NSMutableArray sortedArrayFromRange:options:usingComparator:] + 60 15 CoreFoundation-[NSArray sortedArrayUsingSelector:] + 168 16 UIAccessibility___57-[NSObject(AXPrivCategory) _accessibilityFindDescendant:]_block_invoke + 268 17 UIAccessibility___96-[NSObject(AXPrivCategory) _accessibilityEnumerateAXDescendants:passingTest:byYieldingElements:]_block_invoke + 140 18 UIAccessibility-[NSObject _accessibilityEnumerateAXDescendants:passingTest:byYieldingElements:] + 244 19 UIAccessibility-[NSObject _accessibilityFindFirstAXDescendantPassingTest:byYieldingElements:] + 272 20 UIAccessibility-[NSObject(AXPrivCategory) _accessibilityFindDescendant:] + 100 21 UIAccessibility__axuiElementForNotificationData + 276 22 UIAccessibility__massageAssociatedElementBeforePost + 36 23 UIAccessibility__UIAXBroadcastMainThread + 292 24 libdispatch.dylib__dispatch_call_block_and_release + 32 25 libdispatch.dylib__dispatch_client_callout + 20 26 libdispatch.dylib__dispatch_main_queue_drain + 980 27 libdispatch.dylib__dispatch_main_queue_callback_4CF + 44 28 CoreFoundation___CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 29 CoreFoundation___CFRunLoopRun + 1996 30 CoreFoundation_CFRunLoopRunSpecific + 572 31 GraphicsServices_GSEventRunModal + 164 32 UIKitCore-[UIApplication _run] + 816 33 UIKitCore_UIApplicationMain + 340 34 SwiftUIclosure #1 (Swift.UnsafeMutablePointer<Swift.UnsafeMutablePointer<Swift.Int8>?>) -> Swift.Never in SwiftUI.(KitRendererCommon in _ACC2C5639A7D76F611E170E831FCA491)(Swift.AnyObject.Type) -> Swift.Never + 168 35 SwiftUI SwiftUI.runApp(A) -> Swift.Never + 100 36 SwiftUI static (extension in SwiftUI):SwiftUI.App.main() -> () + 180
2
2
202
Oct ’24
Is it possible to create an App that can't be Deleted?
I want to create an app with features blocking certain content on the internet and iPhone. Before I start coding the app I wanted to see if it's possible with the user's permission to create an app that can't be deleted until after 3 days/timer. Is it possible to create an app with this feature and put it on the Apple Store or do they not allow this?
1
0
156
Oct ’24
Setting tint for widget snapshot tests iOS 18
We have widget snapshot tests using XCTest as shown below: func testHomeWidgetView() { let widgetView = HomeWidgetView( state: .done, text: "All done!" ).frame(width: 170, height: 170) assertSnapshot(matching: widgetView, as: .image) } } Is it possible to apply a tint to the widgets in snapshot tests like a user can from their home screen in iOS 18? We'd like to capture snapshots of our widget while tinted via the home screen.
1
2
188
Oct ’24
After updating iOS 18 CXCall is giving wrong values in hasConnected and hasEnded when user reject the call
Dear Apple team, I would like to report a problem that started after update my iPhone to iOS 18.0.1. When user receives a call and reject, CXCall is giving wrong values compared the previous version of iOS (minor of 18). In iOS 17.7, we received this values: hasConnected = false hasEnded = true iOS 18.0.1 we received 2 CXCall events: first event hasConnected = true hasEnded = false second event hasConnected = true hasEnded = true This behaviour is strange and not intuitive, and if we check the documentation, don`t make sense: A call is considered connected when both caller and callee can start communicating and A call is considered ended when the user disconnects or all other callers disconnect. Our code is very simple and use callObserver function to make the flow: public func callObserver(_ callObserver: CXCallObserver, callChanged call: CXCall) { if call.hasConnected, !call.hasEnded { //GoToViewControllerX } if call.hasEnded { //DoSomething } } With the behavior of iOS 18 the project will enter in first conditional and then will enter in second conditional. I need some help or some instruction because the intention ir only enter in first conditional if the call really happens.
2
3
228
Oct ’24
EventKit refreshSourcesIfNecessary() not triggering real-time sync with Google Calendar events
I'm working on an app that uses EventKit to access calendar events. For users with external calendars like Google Calendar, they can sync these by adding the account through iOS Calendar settings. Once added, the events appear in my app as expected. However, if a user adds a new event in Google Calendar, there’s often a delay before it appears in my app, since the iOS Calendar doesn't sync with external sources like Google in real time. Currently, users can manually trigger a sync by opening the Apple Calendar app and using the pull-to-refresh feature under the "Calendars" tab. This works reliably but isn’t an ideal solution. I tried using the EventKit method refreshSourcesIfNecessary() to minimize the delay, as it claims to "[Pull] new data from remote sources, if necessary" (link to docs). I trigger this method when the app returns to the foreground. But, I'm not seeing the expected results. Here’s a typical sequence: Open my app and send it to the background. Add an event in Google Calendar. Return to my app. Despite invoking refreshSourcesIfNecessary(), the new event doesn’t appear in Apple Calendar (or accordingly in my app), until some random delay (30 seconds to several minutes). In contrast, the Apple Calendar app’s pull-to-refresh fetches the event immediately, every time. Am I misinterpreting how refreshSourcesIfNecessary() is intended to work? Or is there another way to achieve a faster sync with external calendars?
1
0
119
Oct ’24
Get Text From AppEntity not work
https://medium.com/@giulio.caggegi/use-app-intents-with-ios-16-90a341ccbc94 I create a demo according this article, and add the App Intents in Shortcuts App , then add a Scripting "Get text from ***" , but the result is Empty, how could I modify the AppEntity or add which attribute, so the Scripting "Get text from ***" can get text from the App Intents?
4
0
194
Oct ’24
Getting tracks from Recommendation Playlist
Hi all, I am working with MusicKit and have managed to get a user's recommendation playlists (favorites, get up, etc). Isolating just one, I am trying to access the tracks in there using .tracks but it returns nothing. Wondering if I am doing something wrong or if these don't have tracks necessarily associated with them. Code is below (not everything just kinda where I am accessing the playlist) try await requestMusicAuthorization() let request = MusicPersonalRecommendationsRequest() let response = try await request.response() guard let madeForYou = response.recommendations.first(where: { $0.title == "Made for You" }) else { throw NSError(domain: "RecommendationError", code: 0, userInfo: [NSLocalizedDescriptionKey: "No 'Made for You' recommendation found."]) } guard let firstPlaylist = madeForYou.playlists.first else { throw NSError(domain: "PlaylistError", code: 1, userInfo: [NSLocalizedDescriptionKey: "No playlists found in 'Made for You' recommendation."]) } print("Fetching tracks for playlist: \(firstPlaylist.name ?? "Unknown")") let playlistRequest = MusicCatalogResourceRequest<Playlist>(matching: \.id, equalTo: firstPlaylist.id) let playlistResponse = try await playlistRequest.response() guard let playlist = playlistResponse.items.first else { throw NSError(domain: "PlaylistError", code: 2, userInfo: [NSLocalizedDescriptionKey: "Couldn't fetch the playlist details."]) } guard let tracks = playlist.tracks else { throw NSError(domain: "PlaylistError", code: 3, userInfo: [NSLocalizedDescriptionKey: "No tracks found in the playlist."]) }
1
0
181
Oct ’24
Issue with Message Filter Extension service?
My server that backs my Message Filter Extension stopped receiving messages last night. I thought maybe I had broken something in the iOS code, even though I hadn't touched any of the logic related to filtering. So I rolled back my code to a previous version that was definitely working in both test and production and ran it on my test device, setting a breakpoint on the first line of the func handle(_ queryRequest: ILMessageFilterQueryRequest, context: ILMessageFilterExtensionContext, completion: @escaping (ILMessageFilterQueryResponse) -> Void) method in the extension. When sending a message to it from an unknown number, the breakpoint is never even hit. To ensure it was somehow not my code, I started a new blank app and added the Message Filter Extension target. Running it on my test device, it also doesn't ever hit the breakpoint. Is there some Apple service involved in determining whether to send unknown sender messages to Message Filter Extensions that might be down. Maybe it's a beta issue? I'm on iOS 18.1 Beta 4. But it seems odd that all of my users' devices would be encountering a beta-related issue at essentially the same time.
2
0
223
Oct ’24
An issue with DateComponents
The expected number of months for the below code should be -48 months. It used to work like this Until iOS17. Now when building with iOS 18 it gives -47 months. Changing the two dates with one day back works as expected import Foundation var calendar = Calendar(identifier: .gregorian) calendar.timeZone = .gmt let components1 = DateComponents( calendar: calendar, year: 2004, month: 2, day: 29 //28 in case of changing day to 28 it works as expected ) guard let date1 = components1.date else { exit(1) } let components2 = DateComponents( calendar: calendar, year: 2008, month: 2, day: 29 //28 in case of changing day to 28 it works as expected ) guard let date2 = components2.date else { exit(1) } print(date1) print(date2) let months = calendar.dateComponents([.month, .isLeapMonth], from: date2, to: date1) print(months)
1
0
207
Oct ’24
Testing Live Caller ID w/ OHTTP Gateway
Hello there, We are developing our own server for live caller ID service, and we have some questions for end-to-end testing: According to the official documentation, it's said that the OS on user's iPhone will issue OHTTP request to 3rd party's gateway. Is it possible to verify this behavior at local environment, using physical device? If answer to question 1. is no, will Apple provide other beta testing methods? For example via Testflight. Any suggestion helps. Thanks!
0
1
135
Oct ’24
SensorKit Visit Data Inconsistencies Across Devices
Hello, I am currently developing an application using SensorKit to retrieve visit data. While the data retrieval works smoothly on one iPhone (iPhone 14, iOS 18.0.1), it fails on other devices, including: iPhone 15 Pro Max with iOS 18.1 Beta Another iPhone 14 with iOS 18.0 I’ve verified that the entitlements are configured properly, and the app has the necessary SensorKit visit permissions across all devices. Despite these steps, only one of the phones is able to retrieve the visit data correctly. Is there any minimum hardware requirement or compatibility issue with certain models or configurations that I should be aware of for using SensorKit visits? Any guidance or insight would be greatly appreciated! Thank you.
0
0
116
Oct ’24
BGProcessingTaskRequest execute randomly.
I am using BGProcessingTaskRequest to fetch a API make my app up to date. Sometimes this background task execute with 10 minutes some times it take more than 10 mins, Some other times its never execute. But in my case im provide just 1 minute to BGProcessingTaskRequest.earliestBeginDate variable. And i will share my implementation here, My codes are, Called the register function before app launching. let taskId = "_________" func registerBackgroundTaks() { BGTaskScheduler.shared.register(forTaskWithIdentifier: taskId, using: nil) { task in self.handleBackgroundProcessRequest(task: task as! BGProcessingTask) } print("Receiver called") } Called the scheduleBackgroundPrecessingTask function when application enter in background mode. func scheduleBackgroundPrecessingTask() { let request = BGProcessingTaskRequest(identifier: taskId) request.requiresNetworkConnectivity = false // Need to true if your task need to network process. Defaults to false. request.requiresExternalPower = false request.earliestBeginDate = Date(timeIntervalSinceNow: 1 * 60) // Featch Image Count after 1 minute. do { try BGTaskScheduler.shared.submit(request) print("Process notification triggered") } catch { print("Could not schedule background process: \(error)") } } Could anyone share any concerns to my problem? or kindly clarify me why BGProcessingTaskRequest takes time randomly?
4
0
302
Oct ’24
Inconsistent Live Caller ID Lookup Performance
I've noticed delays with the Live Caller ID Lookup feature, taking around 3 to 6 seconds to complete, even on repeated lookups. This seems odd since there's no server activity during these repeats, suggesting the information might be coming from a cache. Most of the time, it’s fast, but there are cases when it's unexpectedly slow, and I haven’t quite figured out the pattern yet. Is anyone else seeing this issue? FB number FB15372765 - with sysdiagnose and video demonstrating the delay.
0
0
172
Oct ’24
App Intents is not able to start an outgoing call with CallKit when the app is backgrounded
I am currently working on integrating an app with Siri, adding support for starting VOIP calls and sending messages. Although it is understood it is recommended to use SiriKit for calling and messaging, I would like to allow users to select a profile to use for calling. As far as I am aware the notion of selecting a profile to call from is not something SiriKit supports, therefore, it was decided to go with App Intents to allow for more control over the parameters utilized to start calls. After integrating VOIP calling with App Intents, I noticed CallKit is not able to start calls when the App Intent is invoked from the background. I get the following error: Error Domain=com.apple.CallKit.error.requesttransaction Code=6 "(null)” This seems to correspond to the CXErrorCodeRequestTransactionError invalidAction. This error only happens when the intent is invoked from the background. Changing the App Intent property openAppWhenRun to true solves the issue as it brings the app to foreground before running the intent. However, I would like to support starting calls from the background to avoid making users unlock their phones prior to starting a call with Siri to make it a truly hands-free experience. I suspect the desired behavior is possible, most likely with SiriKit, as some famous VOIP calling apps (i.e. WhatsApp, Messenger, etc) exhibit the behavior I described. However, is there any way to start calls from the background with App Intents? Or is the desired behavior something exclusive to SiriKit? I have pasted three code snippets below that can replicate the issue. At the moment I am on Xcode Version 15.3, macOS Sonoma 14.6.1, and testing on iOS 16.6.1 To demonstrate the issue I have created the following CXProviderDelegate: class CallManager: NSObject, CXProviderDelegate { func startCall() { let callKitProvider = CXProvider(configuration: CXProviderConfiguration()) callKitProvider.setDelegate(self, queue: nil) let callKitController = CXCallController() let recipient = CXHandle(type: .generic, value: "Demo Outgoing Call") let uuid = UUID() let startCallAction = CXStartCallAction(call: uuid, handle: recipient) let transaction = CXTransaction(action: startCallAction) callKitController.request(transaction) { error in if let error { print(error) } else { print("no errors") } } callKitProvider.reportOutgoingCall(with: uuid, connectedAt: nil) } func providerDidReset(_ provider: CXProvider) { // no-op, not required to demonstrate the issue } } Then, I have a UIViewController that is the only screen of this example app: class ViewController: UIViewController { @IBOutlet weak var startCallButton: UIButton! override func viewDidLoad() { super.viewDidLoad() startCallButton.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside) } @objc func buttonTapped() { let manager = CallManager() manager.startCall() } } As for app intents, I put together a very simple intent to trigger the start of an outgoing call: struct StartCall: AppIntent { static var title: LocalizedStringResource = "Start Call" static var openAppWhenRun = false func perform() async throws -> some IntentResult { let manager = CallManager() manager.startCall() return .result() } } When the UIViewController is presented and I tap the button to start a call I see the green call banner appear and "no errors" is printed to the console as intended. However, when I open the Shortcuts app and run the app intent, the green banner does not appear and the message Error Domain=com.apple.CallKit.error.requesttransaction Code=6 "(null)” is printed to the console.
1
0
186
Oct ’24