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

ControlWidget in iOS 18 Beta not showing and the widget created prior to iOS18 Beta not showing too.
I tried creating a ControlWidget following this Apple document - https://developer.apple.com/documentation/widgetkit/creating-controls-to-perform-actions-across-the-system, but for some reason the Control is not showing while I am trying to add and on top of that the widget which we created prior to iOS18 is also not showing, while trying to add. Here is the gist of code : struct WidgetLauncher{ static func main() { if #available(iOSApplicationExtension 18.0, *) { appWidgetsFor18.main() } else { appWidgets.main() } struct apptWorkWidgets: WidgetBundle { var body: some Widget { WidgetPriorToiOS18() } } @available(iOSApplicationExtension 18.0, *) struct appWidgetsFor18: WidgetBundle { var body: some Widget { WidgetPriorToiOS18() PerformActionButton() //This from the apple's document. } } @available(iOSApplicationExtension 18.0, *) struct PerformActionButton: ControlWidget { var body: some ControlWidgetConfiguration { StaticControlConfiguration( kind: "com.example.myApp.performActionButton" ) { ControlWidgetButton(action: PerformAction()) { Label("Perform Action", systemImage: "checkmark.circle") } } .displayName("Perform Action") .description("An example control that performs an action.") } } struct PerformAction: AppIntent { static let title: LocalizedStringResource = "Perform action" func perform() async throws -> some IntentResult { // Code that performs the action... return .result() } }
0
0
102
5d
XSLT 2.0 transformation with Swift or WKWebView
I am re-writing with Xcode and Swift two applications (DDB Access, SmartHanzi) initially written with Xamarin and C#. Both apps are with separate macOS and iOS versions (storyboard). In the original version, XSLT 2.0 transformations were applied with C#. With Swift and WKWebView, after carefully reviewing the documentation, I just found: XSLT 1.0 transformation for macOS (Swift). Nothing at all for iOS. Some years ago, there seemed to be a possibility with an external C library, but it was also mentioned that at a moment it was no more accepted by the App Store. Did I miss something in the documentation and how can I apply these XSLT 2.0 transformations (preferrably from an XML string but temporary files would be acceptable)?
13
0
206
5d
Weatherkit Apparent Temperatures
Recently I've noticed, and my users have noticed, that Weatherkit is returning dubious values for apparent temperatures. For example, in monitoring S. Florida this week, Weatherkit is returning apparent temps 1 to 2 degrees warmer than actual temps. (85, feels like 86.) All other services are reporting ~10 - 15 degree differences. (85, feels like 96) I believe this is a recent development. Are others having the same issue?
0
0
81
5d
Get notified on 'Selected Contacts' updates
Is there a way for the application to get notified when user updates their 'Selected Contacts' from the Settings app when the Contacts permission on the application is set to the new iOS 18 CNAuthorizationStatusLimited status? My logic already listens for the CNContactStoreDidChangeNotification notification, but it doesn't look like it is being fired under this scenario. Do we have to setup a new CNChangeHistoryFetchRequest every time the application becomes active and compare the result? Is the value of the currentHistoryToken updated when user selects / deselects entries from their 'Selected Contacts'?
2
0
106
5d
Carrier File MCC MNC
We are Telecom company and we are already registered in GSMA We have started testing our product environment and everything has been working smoothly with Android handsets. However, we are facing some challenges with iPhone handsets. We only use IPV6 for UE addresses allocation and we are seeking your support and guidance on how to register our MVNO MCC and MNC in the iPhone carrier file. Your assistance in this matter would be greatly appreciated.
1
0
149
5d
Request for Assistance with NFC-Based Door Unlocking Functionality
Dear Apple Developer Support, I hope this email finds you well. I am writing to seek your assistance regarding an advanced NFC functionality we aim to implement in our existing iOS application. Our application provides a mobile access solution for businesses, eliminating the need for traditional key fobs by enabling door access via smartphones. We are currently working on a feature to unlock doors using NFC tags. The NFC tags will contain specific information for each lock, and users will unlock the door by tapping their iPhone to the tag. To enhance the user experience, we aim to: Bypass the NFC prompt that requires user interaction to confirm the NFC read. Unlock the door without needing to open the app. Our goal is to provide a completely touchless and seamless access experience for our users. However, we understand that there are certain security and privacy constraints in place. We are looking for guidance on: Any potential solutions or workarounds that would allow us to achieve our desired functionality. Possibilities for requesting special permissions or utilising system-level APIs to enable background NFC reading and actions without user interaction. We appreciate any assistance or recommendations you can provide to help us deliver a superior user experience while adhering to iOS security guidelines. Thank you for your time and support. Best regards, Pavez
0
0
43
6d
Bug in Calendar.date(from:) in iOS 18? It is now underspecified with year, weekOfYear, and yearForWeekOfYear?
One of our apps has some failing unit tests that I traced back to a change in the way Calendar.date(from:) works on iOS 18 beta (22A5307d) as compared to earlier versions. The simple demo unit test below passes in iOS 17.5 and fails in 18 beta 3. I did not test this in other beta versions. import XCTest final class DateComponentsMath_Tests: XCTestCase { func testAddingWeek() throws { var components = DateComponents( year: 2024, weekOfYear: 1, yearForWeekOfYear: 2024 ) let date1 = Calendar.current.date(from: components)! // add a few weeks to the components components.weekOfYear = components.weekOfYear! + 5 let date2 = Calendar.current.date(from: components) XCTAssertNotEqual(date1, date2, "We added five weeks to the components so this should not result in the same date") } } It appears that in iOS 18 (22A5307d), year, weekOfYear, and yearForWeekOfYear are no longer enough to uniquely specify a date. With those three values, Calendar.date(from:) always returns January 1 of the specified year. In earlier versions of iOS this was not the case. I submitted this as FB14323984
4
0
167
6d
The CPTemplate memory is not released
My code is as follows [_interfaceController pushTemplate:template animated:YES completion:^(BOOL success, NSError * _Nullable error) { }]; push a template, and the memory will increase accordingly, but after clicking exit, the memory will not drop down, resulting in continuous accumulation And my page is a list, each item contains an image, memory is growing very fast Does template need to manage memory by itself?
1
0
124
6d
The watchOS support of NSValue.CGSizeValue
Starting from Xcode 16 Beta 2, NSValue.CGSizeValue is no longer available on watchOS, whereas this method was supported in previous versions of Xcode. The Xcode header files mark this method as unavailable on watchOS, but after manually modifying the Xcode files to remove the unavailable macro, the code compiles and runs normally. Is there a change in this API that makes it unsupported on watchOS, or is this an error? Previously, I submitted feedback FB14072192, and the status of this feedback was updated to "Unable to diagnose with current information" without any further response. If this is indeed an issue, I hope it can be fixed.
2
1
179
1w
detecting Phone Number changed
Hello, I am involved in planning a digital ID app for the government. We are aiming to provide various personal information through this app, including the consideration of including the user's phone number. During the app installation process, we can collect the accurate user's phone number through SMS verification. However, I'm curious if there's a way for our app or server to detect when a user changes their phone number after installing the app. I understand that Apple's policies prevent us from automatically collecting the user's phone number. However, it would be beneficial if we could at least know if the phone number provided by the server differs from the current phone number on the smartphone.
3
0
128
1w
How should a Widget communicate with the main app's Audio objects
If I have an interactive widget, with button that triggers an AudioPlaybackIntent, how should the intent communicate with the main app's audio player to pause/play? I was thinking about instantiating the player in the Widget explicitly in its lifecycle. But, if the audio player gets instantiated separately in the app and in the widget, wouldn't I have two players running? Or am I misunderstanding the setup?
0
0
129
1w
I want to know is this harmful
63 ??? (Foundation + 69644) [0x197ad600c] 63 ??? (com.apple.StreamingUnzipService + 39148) [0x1009a58ec] 60 ??? (com.apple.StreamingUnzipService + 47188) [0x1009a7854] 60 ??? (libsystem_kernel.dylib + 24156) [0x1e1d50e5c] 57 <on behalf of appstored [175] (originated by nsurlsessiond [109])> 3 <on behalf of appstored [175] (originated by appstored [175]), Effective Thread QoS User Initiated, Requested Thread QoS User Initiated> 3 ??? (com.apple.StreamingUnzipService + 47560) [0x1009a79c8] 3 ??? (libsystem_kernel.dylib + 24156) [0x1e1d50e5c] 3 <on behalf of appstored [175] (originated by nsurlsessiond [109])> 28 ??? (libsystem_pthread.dylib + 18680) [0x1f5af38f8] 28 ??? (libdispatch.dylib + 90268) [0x1a0b5409c] 28 ??? (libdispatch.dylib + 88212) [0x1a0b53894] 28 ??? (libdispatch.dylib + 26868) [0x1a0b448f4] 28 ??? (libdispatch.dylib + 29532) [0x1a0b4535c] 28 ??? (libdispatch.dylib + 15828) [0x1a0b41dd4] 28 ??? (libdispatch.dylib + 8508) [0x1a0b4013c] 28 ??? (com.apple.StreamingUnzipService + 74144) [0x1009ae1a0] 28 ??? (com.apple.StreamingUnzipService + 70208) [0x1009ad240] 27 ??? (com.apple.StreamingUnzipService + 70912) [0x1009ad500] 27 ??? (libsystem_kernel.dylib + 24156) [0x1e1d50e5c] 26 <on behalf of appstored [175] (originated by nsurlsessiond [109])> 1 <on behalf of appstored [175] (originated by appstored [175]), Effective Thread QoS User Initiated, Requested Thread QoS User Initiated> 1 ??? (com.apple.StreamingUnzipService + 70820) [0x1009ad4a4] 1 ??? (com.apple.StreamingUnzipService + 64680) [0x1009abca8] 1 ??? (libsystem_kernel.dylib + 26968) [0x1e1d51958] 1 <on behalf of appstored [175] (origi
1
0
162
1w
Xcode provisioning profile doesn't include CallKit directory
I'm trying to use the callkit library on Xcode 15 but I'm getting the errors below. Error 1:Automatic signing failed Xcode failed to provision this target. Please file a bug report at https://feedbackassistant.apple.com and include the Update Signing report from the Report navigator. Error 2: Provisioning profile "iOS Team Provisioning Profile: me.liu.brian.Autocall.CallDirectoryHandler" doesn't include the Com.apple.developer.callkit.call-directory entitlement. I already generated the .entitlements file in both my main app and callDirectoryHandler. When I try to enable the CallKit capability in the Identifiers or Profiles section on apple developer.com, the CallKit Capability simply isn't listed under any of the sections, so I can't enable it. What can I do to use CallKit in my app?
0
0
112
1w
Shortcut Execution Speed?
Is there anything that can be done to speed up the execution of a Shortcut? There is a Shortcut that many users opt to use with my app that is only effective if it runs immediately - the reality, though, is that it often takes 1-2 seconds for the Shortcut to trigger, rendering it largely useless (the Shortcut is meant to prevent users from being able to disable Screen Time in Settings). Has anyone had success with this, and/or are there other approaches we could be taking?
0
0
125
1w
"App not responding" in the dock menu
I have a bundled macOS application. This is a non-interactive application where I m performing some task on the worker thread while the main thread waits for this task to be completed. Sometimes this task can be time consuming. I have observed that when I run the application using the bundle( like double click or open command) I can see the OS marking my application as not responding( this is evident as the app icon toggles in the dock and then it states not responding). Although If I run the unix executable in the bundle, the app runs and I do not see the not responding status anywhere. I wanted to understand If this is happening because my main thread is in a waiting state? If yes, what could I do to resolve it because my application logic demands the main thread to wait for the worker thread to complete its task. Is there some way to use some event loop like GCD? Note: I cannot use the delegates(Appkit) event loop because my application will be run in non-GUI context.
5
0
195
1w
MacOS bundle's binary can't run
I made a project with MacOS/Bundle/Objective-C. I added main.m as like: #import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { printf("Test\n"); } Built it and the generated bundle. I open the bundle with Finder and located the binary in the MacOS directory within the bundle. The file command returned as like: <path...>TestProject: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit bundle x86_64] [arm64:Mach-O 64-bit bundle arm64] <path...>TestProject (for architecture x86_64):Mach-O 64-bit bundle x86_64 <path...>TestProject (for architecture arm64): Mach-O 64-bit bundle arm64 It apparently generated the Universal binary. Of course, no error were reported on building. I tried to execute the binary with drag&drop the file into Terminal, but shell reported as like: zsh: exec format error: <path..>TestProject These are reproducing my trouble. My target project is so old but it can generate executable x86_64 only binary. I want to be universal binary. My Xcode is 15.4 on Sonoma.
1
0
149
1w
Share arbitrary struct from HostApp to Extension and get arbitrary result back
I want to share a Transferable (JSON-encoded) data struct from some HostApp with an Extension of my ContainingApp, and get a different Transferable (also JSON-encoded) data struct back on success. Since I want to present my ContainingApp's AppIcon in the sharing sheet to make it easy for the user to find it, I started building a Sharing Extension and not an Action Extension. AFAIK the difference is only in the presentation (Sharing Extension: Icon+name of the ContainingApp vs Action Extension: simple b/w system icon plus a string describing the action (e.g. "Copy", "Save to Files")), and the data flow is identical. Please correct me if I'm wrong. I added the Sharing Extension to my ContainingApp (which are both in the same app group so they can use a shared container to exchange data). The (real) HostApp is from a different company we are collaborating with, and thus is not in our app group. Once everything runs I will add a tailored NSExtensionActivationRule to make sure our Sharing Extension is only shown to our partner's HostApp. Currently I am still using TRUEPREDICATE. The goal is that after the user tapped the "Continue with ContainingApp" (Share-)button in the HostApp, iOS will only show my ContainingApp icon and nothing else, since that's the only useful choice for the user. Side Question 1: The best user experience would be if the HostApp could directly present our extension when the user tapped the "Continue with ContainingApp"-button, without the user needing to choose it manually in the Share-sheet, but I guess this is not possible for privacy/security reasons, right? In the debugger of the HostApp I see this error: Type "com.myapp.shareInput" was expected to be exported in the Info.plist of Host.app, but it was imported instead. Library: UniformTypeIdentifiers | Subsystem: com.apple.runtime-issues | Category: Type Declaration Issues but I definitely want to define and export both ShareInput and ShareResult as UTExportedTypeDeclarations in my extension, and all 3rd-party apps (like this demo HostApp) using my extension need to import them. Side Question 2: Can I just ignore this error? And tell the 3rd-party app developers they also can ignore it? After the user tapped on the ContainingApp icon in the sharing dialog, my Sharing Extension will show its dialog, presenting the shared item it got from the HostApp, and let the user edit the text. When the user taps the "Save"-button in my extension, it creates a ShareResult struct to send back to the HostApp, and dismisses the sheet. This (kinda) works when I share plain text with the 􀈂Text button in my HostApp. My ContainingApp icon is shown together with Mail, Messages, and other apps that can process plain text; with shortcuts to persons and devices (AirDrop targets) in the line above, and with actions (Copy, New Quick Note, Save to Files, Save to Citator, Certificat, Airdrop) below. When I choose my ContainingApp, the extension runs and shows the text it got. ("Kinda" because I am still struggling to send data back. See below...) So the principal operation works... Side Question 3: In the HostApp, can I use ShareLink() to present the Share-sheet and receive the result struct or do I always need to activityViewController!.completionWithItemsHandler = completionHandler windowScene.keyWindow?.rootViewController?.present(activityViewController!, animated: true, completion: nil) and process the result in the completionHandler? If returning (any) data from the extension is possible with ShareLink() also, then how? I didn't find any sample showing this... I implemented the ShareLink() anyway (and ignore the result part for the moment). When I try to share a ShareInput struct with the 􀈂ShareLink button, the same persons are sorted differently, there are less app icons (9 instead of 13), and less actions (only 3: New Quick Note, Save to Files, AirDrop): Note that while the preview correctly shows the preview text provided ("shareInput"), the preview image left of it is blank (instead of arrowshape.right.fill): let preview = SharePreview("shareInput", image: Image(systemName: "arrowshape.right.fill")) When I choose my ContainingApp, the extension runs ... On iOS17, I see that indeed my ShareInput data arrived in my extension: ❗️itemProvider=<NSItemProvider: 0x301b1c460> {types = ( "com.myapp.shareInput" )} Library: ShareExtension | Subsystem: com.myapp.containingdemo.ShareExtensionDemo | Category: ShareSheet However, on iOS 16 it doesn't work: Host[8615:634470] [Type Declaration Issues] Type "com.myapp.shareInput" was expected to be exported in the Info.plist of Host.app, but it was imported instead. Host[8615:634462] [ShareSheet] Couldn't load file URL for Collaboration Item Provider:<NSItemProvider: 0x280f49180> {types = ( "com.myapp.shareInput" )} : (null) That error is shown before I choose the ContainingApp to share with. When I do that, I get: ShareExtension[8774:636786] [ShareSheet] ❗️itemProvider=<NSItemProvider: 0x28243a300> {types = ( "dyn.age8u", "public.file-url" )} which clearly shows the ShareInput struct was not transferred to the extension. But since I don't know how to transfer the ShareResult back to the HostApp when using a ShareLink, I cannot continue this approach anyway. When I try to share a ShareInput struct with the 􀈂JSON button (using present(activityViewController)), I see (both on iOS 16 and iOS 17): My extension (rather, the ContainingApp's icon) is not shown as Sharing target (even though it still has TRUEPREDICATE), which means that my code didn't manage to pack the ShareInput struct for the activityViewController - and thus it doesn't know what to share. I did the same as with the plainText item before: let shareInput = ShareInput(inputStr: "ShareInput as JSON") let preview = SharePreview("shareInput", image: Image(systemName: "arrowshape.right.fill")) VStack(spacing: 25.0) { Text("HostApp!") ShareButton(title: "Text", shareItems: [ItemSource(dataToShare: "sharing some text")]) ShareButton(title: "JSON", shareItems: [ItemSource(dataToShare: shareInput)]) ShareLink("ShareLink", item: shareInput, preview: preview) } (I will continue in the next posting)
7
0
174
1w