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

App Shortcut "Couldn't find AppShortcutsProvider"
I am trying to create a shortcut following "Implement App Shortcuts With App Intents" talk from WWDC2022. The below is my MWE. In a standalone app, this can be extended and behave like the video. Adding this code to my main app, makes the shortcut show up within the Shortcuts app, but if I click on it, it pops up an alert saying Error Domain=LNActionForAutoShortcutPhraseFetchError Code=1 "Couldn't find AppShortcutsProvider" UserInfo={NSLocalizedDescription=Couldn't find AppShortcutsProvider} My main app has several targets, so I suppose I need to establish which one is the shortcuts provider, but I cannot find any reference to how to do this in the documents. Via Siri, the shortcut command is not recognised at all. import AppIntents import SwiftUI struct DoSomething: AppIntent {  static var title: LocalizedStringResource = "Do something"  func perform() async throws -> some IntentResult {   return .result()  }  static var openAppWhenRun: Bool = false } struct MyShortcuts: AppShortcutsProvider {  @AppShortcutsBuilder  static var appShortcuts: [AppShortcut] {   AppShortcut(    intent: DoSomething(),    phrases: ["Do Something in \(.applicationName)"],    systemImageName: "books.vertical.fill"   )  } }
5
1
2.3k
Jul ’22
Payment with CarPlay
Assuming that I have an iOS app which is managing the payment method of the user (e.g. credit card), what is preventing me to build a CarPlay app (e.g. EV charging app) with a button that triggers the payment of the charging station? I mean, what are the advantages that will be introduced with iOS 16 that will allow the payment of gas stations from CarPlay?
2
0
1.7k
Jul ’22
AppShortcuts limit for 10 shortcuts
Hi, according this WWDC session https://developer.apple.com/wwdc22/10170 App Shortcuts are defined in Swift code, by implementing the AppShortcutsProvider protocol. To implement the protocol, I'll simply create a single getter that returns all the app shortcuts I want to set up for the user. Note that in total, your app can have a maximum of 10 app shortcuts. However, most apps only need a few. there is a limit for up to 10 AppShortcuts. Could you please clarify how that limit handled? 🤔 (e.g. project failed to build / app will crash or malfunction / only 10 shortcuts will be handled on random/ordered choice by iOS) I suppose there is some way to manage shortcuts amount but see no details at documentation yet.
5
1
2.2k
Jul ’22
App group shared user defaults
In iOS 16 beta 3, my iOS app sets some strings in the shared user defaults of the app group. The iOS widget extension reads the strings from the shared user defaults correctly, but the watchOS app and watchOS widget extension could not read them (get nil). Integers stored in the shared user defaults can be read everywhere. All targets are in the same app group. Does anyone have similar problems?
7
0
4.2k
Jul ’22
WeatherKit Apple Weather trademark and legal link.
I have read the WeatherKit docs and watched the "Meet WeatherKit" WWDC video but it is not clear where the trademark and legal link need to be displayed. Can someone at Apple please clarify this. The docs state: "If your apps, web apps, or websites display any Apple weather data, you must clearly display the Apple Weather trademark, as well as the legal link to other data sources." I have a calendar style app on the App Store and want to incorporate weather data as simple icons into the day, week, month views with in the app. Is it ok to just display the trademark and legal link in the app's Settings view where a user would first turn on this weather feature? Or does it have to be displayed on every single view where weather data is displayed? Even if that data is just displaying a simple Sun or Cloud or Rain symbol to the user. Thanks.
3
3
1.8k
Jul ’22
CarPlay Simulator not Working
I am trying to run my navigation app on a physical device, and want to view it using CarPlay Simulator (through XCode additional tools, NOT Hardware->Display->CarPlay), however, when I try to use the app, device has a Red dot next to it, and the simulator shows nothing. What I've tried: Running on a real CP device(my car): App works as intended, but want to run simulator so I can have live debugging Forgetting CP device and reconnecting All Steps of "Troubleshooting CP Simulator" (Updating to latest iOS, restarting phone, turn off hotspot, not connected to any other CP devices, ensure Firewall allows incoming connections) Tried both Xcode 13 CP sim and Xcode 14 beta CP sim Tried both work and personal laptops/phones Ideas: I am running on a M1 laptop, which could be messing with something. I am also running my Xcode in Rosetta(app has packages that cannot compile without Rosetta), but I don't believe this should be a problem because I am running on a physical device not Xcode simulator. Also can't run on Hardware->Display->CarPlay because of Application does not implement CarPlay template application lifecycle methods in its scene delegate and I can't figure out how to fix ("EXCLUDED_ARCHS[sdk=iphonesimulator*]"= "arm64" does not work)
7
6
4.6k
Jul ’22
Getting "Caught Error Domain NSURLErrorDomain Code=-1200 \"An SSL error has occurred and a secure connection to the server cannot be made."?
We've enabled ATS restrictions in our app, and everything works fine, except sometimes, randomly, the CDN download resource fails. In most cases, it happens to users who on iOS 14.* and WiFI (VPN helps solve the problem :thinking_face:) Logs: (ExampleClientErrorLogServlet) :: Client error: {"arguments":["test_resource","Caught Error Domain%3DNSURLErrorDomain Code%3D-1200 \"An SSL error has occurred and a secure connection to the server cannot be made.\" UserInfo%3D{NSErrorFailingURLStringKey%3Dhttps://my-url/reource.bin, NSLocalizedRecoverySuggestion%3DWould you like to connect to the server anyway?, _kCFStreamErrorDomainKey%3D3, _NSURLErrorFailingURLSessionTaskErrorKey%3DLocalDownloadTask <A50DCF0E-38F3-4454-A78A-B4552336561E>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey%3D(\n \"LocalDownloadTask <A50DCF0E-38F3-4454-A78A-B4552336561E>.<1>\"\n), NSLocalizedDescription%3DAn SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey%3Dhttps://my-url/reource.bin, NSUnderlyingError%3D0x2882e1050 {Error Domain%3DkCFErrorDomainCFNetwork Code%3D-1200 \"(null)\" UserInfo%3D{_kCFStreamPropertySSLClientCertificateState%3D0, _kCFNetworkCFStreamSSLErrorOriginalValue%3D-9816, _kCFStreamErrorDomainKey%3D3, _kCFStreamErrorCodeKey%3D-9816, _NSURLErrorNWPathKey%3Dsatisfied (Path is satisfied), viable, interface: en0, ipv4, dns}}, _kCFStreamErrorCodeKey%3D-9816}"],"format":"Downloading {} file failed: {}","platform":"ios","version":"2.87.1"} 26.07.2022 01:39:55 [DEBUG][9] :: platform: ios, version: 2.87.1. Downloading test_resource file failed: Caught Error Domain%3DNSURLErrorDomain Code%3D-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo%3D{NSErrorFailingURLStringKey%3Dhttps://my-url/reource.bin, NSLocalizedRecoverySuggestion%3DWould you like to connect to the server anyway?, _kCFStreamErrorDomainKey%3D3, _NSURLErrorFailingURLSessionTaskErrorKey%3DLocalDownloadTask <A50DCF0E-38F3-4454-A78A-B4552336561E>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey%3D( ), NSLocalizedDescription%3DAn SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey%3Dhttps://my-url/reource.bin, NSUnderlyingError%3D0x2882e1050 {Error Domain%3DkCFErrorDomainCFNetwork Code%3D-1200 "(null)" UserInfo%3D{_kCFStreamPropertySSLClientCertificateState%3D0, _kCFNetworkCFStreamSSLErrorOriginalValue%3D-9816, _kCFStreamErrorDomainKey%3D3, _kCFStreamErrorCodeKey%3D-9816, _NSURLErrorNWPathKey%3Dsatisfied (Path is satisfied), viable, interface: en0, ipv4, dns}}, _kCFStreamErrorCodeKey%3D-9816} _kCFNetworkCFStreamSSLErrorOriginalValue=-9816 _kCFStreamErrorDomainKey=3 _kCFStreamErrorCodeKey=-9816 We've tried nscurl --ats-diagnostics on the URL: Configuring ATS Info.plist keys and displaying the result of HTTPS loads to https:/url-path. A test will "PASS" if URLSession:task:didCompleteWithError: returns a nil error. ============================================================== Default ATS Secure Connection --- ATS Default Connection ATS Dictionary: {} Result : PASS --- ============================================================== Allowing Arbitrary Loads --- Allow All Loads ATS Dictionary: {     NSAllowsArbitraryLoads = true; } Result : PASS --- ================================================================================ Configuring TLS exceptions for url --- TLSv1.3 ATS Dictionary: {     NSExceptionDomains =     {         "url" =         {             NSExceptionMinimumTLSVersion = "TLSv1.3";         };     }; } Result : FAIL Error : Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSErrorFailingURLStringKey=url, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <250D7C7A-A090-41F1-8FED-E73FCB511F41>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(     "LocalDataTask <250D7C7A-A090-41F1-8FED-E73FCB511F41>.<1>" ), NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=url, NSUnderlyingError=0x6000021318f0 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, _kCFNetworkCFStreamSSLErrorOriginalValue=-9836, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9836, _NSURLErrorNWPathKey=satisfied (Path is satisfied), viable, interface: lo0}}, _kCFStreamErrorCodeKey=-9836} --- ====================================== nsurl --ats-diagnostic show me another error code -9836 and like I know TLSv1.3 not necessary yet Maybe someone can give some suggestions, any help !! :pray: Thx!
2
2
2.5k
Jul ’22
URLComponent does not accept IPv6 address as host in iOS 16
iOS 16 introduced "Internationalized Domain Name" support for URLComponent. As a result, URLComponent does not accept IPv6 address as host in iOS 16. Is this expected behaviour or a bug, and what would be the best workaround in this case? // IPv4 URL var ipv4URLComponents = URLComponents() ipv4URLComponents.scheme = "https" ipv4URLComponents.host = "66.94.29.13" if let url = ipv4URLComponents.url {     print("IPv4 URL:", url) } // IPv6 URL var ipv6URLComponents = URLComponents() ipv6URLComponents.scheme = "https" ipv6URLComponents.host = "2001:0000:3238:dfe1:0063:0000:0000:fefb" if let url = ipv6URLComponents.url {     print("IPv6 URL:", url) } Output on iOS 15.5 device: IPv4 URL: https://66.94.29.13 IPv6 URL: https://2001%3A0000%3A3238%3Adfe1%3A0063%3A0000%3A0000%3Afefb Output on iOS 16 device: IPv4 URL: https://66.94.29.13 IPv6 URL: https: Related thread: https://developer.apple.com/forums/thread/709284
4
0
1.6k
Jul ’22
I'm confused about WatchKit and WidgetKit and Watch Apps... Help!
Sorry for the length of this post, and all the questions. I have an iOS app written in Objective-C (too big to convert to Swift right now), and I successfully added a WatchKit app and WatchKit Extension some years ago. I also added Home Screen widgets when iOS 14 was released. With the iOS 16 betas I'd like to support Lock Screen widgets, and have also decided to move the WatchKit app/extension to SwiftUI. User journey: MyApp is launched and an item with an image is created. This item is stored in Core Data and its image is stored in a directory in the app's documents directory. A version of it is stored in NSUserDefaults in a shared app group. The user adds a Home Screen widget to show that item. Its data is pulled from the defaults, and the image is loaded from the document's directory. The user installs the Watch app and launches it. The Watch app looks inside the user defaults to retrieve the item. The iOS app sends the image to the Watch and the Watch app stores it locally (it's a small image, taking up barely a few Kb). This all works fine right now. Currently I have these targets: MyApp = main iOS app. MyApp WatchKit = Watch app storyboards and asset catalogs. MyApp WatchKit Extension = code to update the Watch interface. MyApp Widget = Home Screen widgets. MyApp IntentHandler = dynamic intents handler for the Home Screen widgets. Q1. Where do I put the code for the Lock Screen widgets? I figure these go into the My App Widget target because they're widgets and appear on the iPhone? In this video (https://developer.apple.com/videos/play/wwdc2022/10050) at 07:00 it tells you to duplicate the existing Widget target, change the bundle, change it to run on watchOS and embed it in your existing Watch App. As my original Watch App is written in Objective-C (MyApp WatchKit Extension, above) I can't/shouldn't do that, so... Q2. I think I have to create a new MyApp Watch App target, and perform the video steps on that target? I can create the views for that app, no problem. Most people update to the latest watchOS, and it's only now that watchOS 9 won't support Watch Series 3. Q3. Do I need to keep MyApp WatchKit and MyApp WatchKit Extension around? I can support older versions of watchOS if it helps my users, but they'll probably want to use the new version of watchOS, right? Can you install both versions of the app on your Watch (with watchOS 9), or does the new Swift app override the old WatchKit extension? Q4. Once I've designed the new Watch App's views in SwiftUI to replace the old WatchKit extension, where do I put the code for the complications that are being replaced? The WWDC 2022 videos (above, and a couple linked to on that page) have confused me a bit. Do I put complications views in the new MyApp Watch App target along with the other views that replace the old Watch app, or in MyApp Widget? Q5. The MyApp Widget target contains a bunch of code (WidgetUtils.swift) that populates the Home Screen widgets (and the new Lock Screen widgets), and it would fit right into the new MyApp Watch App target. Can I share that code between the two app targets just by adding WidgetUtils.swift to both target's membership? MyApp sends small images to the current MyApp WatchKit Extension. There's no code in the existing WidgetUtils.swift to handle file transfers because the images for the Home Screen widgets are pulled from the iOS app, so I need to write that in Swift for the new MyApp Watch App. The logic is already there in the old target, but I can't see any sort of equivalent to the WatchKit extension delegate where I currently handle the file transfers. Q6. Where does that go in MyApp Watch App? The existing MyApp WatchKit Extension occasionally asks MyApp for some new data. This is all done in the extension delegate which wakes up the iOS app and updates the NSUserDefaults which the extension then reads from. Q7. How do you do that in MyApp Watch App? Don't be afraid to be verbose in your responses. The more detail the better! Thank you in advance.
4
0
2.8k
Aug ’22
Your app requires users to provide their name and/or email address after using Sign in with Apple.
Hi there, This is the first time to post here and I hope someone can share similar experience. Our company app update was rejected twice within a week by this reason. (Your app requires users to provide their name and/or email address after using Sign in with Apple. ) Which we already submitted a new build of this fix along with an explanation and screen recording. However as you may know, there's no way to retrieve username after the first-time Apple sign in (value is null), so what our solution is to save the username in our server instantly after the 1st time API callback. It works as expected in several physical devices and simulators. However, I wonder the situation now is: The device / robot that use to check our APP didn't clear the "Apps Using Apple ID" in iOS setting, the fix will not work because it has already passed the 1st time login. Otherwise in our side, we cannot find and resolve the issue. Anything I can do other than file an appeal to App Review Team? Thanks for your time.
3
2
2.7k
Aug ’22
IOS 16 callkit answering in lockscreen
i have a problem when answering call on via callkit ui if my app is in lockscreen and killed state. I am currently using skyway for the audio and video call issue description when the call receiveranswersr the via callkit ui , the receiver will not receive an answer till he will visit the app . this issue doesn't happen on ios 15 version
4
3
2.5k
Aug ’22
Consistently getting JWT errors
I have added the WeatherKit capability and enabled it in the developer account for the respective app id. I continually get this error. Any ideas on how to fix this? Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors
4
3
1.4k
Aug ’22
iOS App Clip Prefix Matching Not Working
App clip cards are not being displayed correctly according to the url prefixing documentation which states: "The system then chooses the App Clip experience with the URL that has the most specific matching prefix." This video also outlines the same strategy for invoking different app clip cards with a matching prefix (start video at 12:46).   I have the following two advanced app clip experiences associated with my app:  https://example.com/card1 -> opens correctly https://example.com/card1/subcard1-> opens same card as above Even though the second experience has a more specific url, it's still opening the app clip experience for the shorter url. Both app clips were submitted over a week ago at the same time, so I don't believe it's a propagation issue.
2
0
751
Aug ’22
App Shortcuts with parameterized phrases not working
When using just the application name in a phrase, it works great and the shortcut can be invoked via Siri: e.g. "Show books in \(.applicationName)" // This works But introducing a parameter in a phrase fails to create a working shortcut that can be invoked via Siri: e.g. "Show \(\.$book) in (\.applicationName)" // Does not work where $book is a parameter for BookEntity in my intent. i am calling updateAppShortcutParameters() and i only have a single book titled "Frankenstein". When my App is launched after a fresh install, i can see that a shortcut is automatically created in the Shortcuts App but has the following title: "Show %@ in MyAppName" Even though the title looks incorrect, tapping the shortcut works and the correct book title is passed to my Intent. However, i cannot invoke the shortcut using Siri. i.e. saying "Show Frankenstein in MyAppName" does not work. Has anyone run into this particular issue? i am running Xcode 14 Beta 6 and iOS 16 Beta 7 on my iPhone. Also tested in iOS Simulator and got the same results. This is arguably the biggest selling point for App Shortcuts (zero setup required by the user) so i am hoping it is addressed before iOS 16 becomes officially available.
8
3
3.1k
Aug ’22
iOS 16 Live Activity + SwiftUI Previews
Is it possible to see a preview of the Live Activity UI we design? For a regular widget, we pass in a WidgetPreviewContext modifier where we specify the size of the widget to preview. Is it possible to do something similar to see how the live activity would appear without having to run the app and then see how the live activity appears on the Lock Screen?
3
6
2.0k
Aug ’22
Older watch app with extension template, unable to load any saved data from UserDefault watchOS 9 beta 7
Hi all, I am working with an older watch app that still uses the older template that combines the WatchKit App and WatchKit App Extension targets. While trying to migrate the ClockKit complication to the new WidgetKit complication, I cannot get the widget complications to load anything from user defaults. It seems like the widget complications are not using the same user defaults as the watch app though being in the same App Group. I experimented with a new watch app using the new SwiftUI template and the WidgetKit complication was able to load data from user default successfully. Did anyone got WidgetKit complication to load data successfully from user default with the older watch app template? Thanks in advance!
3
0
1.3k
Sep ’22