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

MFMailCompose won't accept input after iOS 18 upgrade
I'm supporting an older iPad app (UIKit and objective C). The ability to send email is a critical part of our app and it's no longer working after upgrading to iOS 18. Every time we create a MFMailComposeViewController, it refuses to accept input from the user. There are multiple UIViewControllers in our code where we create a MFMailComposeViewController for our users to send email from, and the problem consistently affects all of them. I've upgraded XCode to 16, and written a minimal demo app to try and repro the problem, but haven't been able to repro the problem so far. When the problem happens, in the XCode console I get a warning, "User interaction with com.apple.MailCompositionService was ignored because it is currently presented in an unsupported configuration. Ensure this view's appearance hasn't been modified." We're not really doing anything special with it, just the bare basics you would expect when creating a dialog for a user to send an email. No special formatting. But I can't repro the problem In a minimal demo so there's gotta be something different that I'm not accounting for. Any ideas? Here's the simplest code from our app that triggers the problem: - (IBAction)sendEmailButtonTapped { NSLog(@"Send Email button tapped"); if ([MFMailComposeViewController canSendMail] == NO) { [[[UIAlertView alloc] initWithTitle:@"Mail Problem" message:@"Can't currently send mail. You may not have any mail accounts set up on this iPad." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil] show]; return; } MFMailComposeViewController* mailComposer = [[MFMailComposeViewController alloc] init]; mailComposer.mailComposeDelegate = self; { NSString * userEmail = [AMPMercuryModel shared].user.userEmail; [mailComposer setCcRecipients:@[userEmail]]; } NSArray* mfrEmail = [AMPMercuryModel shared].selectedManufacturer.orderDeskEmails; if ([mfrEmail count]) [mailComposer setToRecipients:mfrEmail]; [self presentViewController:mailComposer animated:YES completion:nil]; } - (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error { [controller dismissViewControllerAnimated:YES completion:nil]; NSString* failureMessage; switch (result) { case MFMailComposeResultFailed: failureMessage = [NSString stringWithFormat:@"%@\n%@",[error localizedDescription],[error localizedFailureReason]]; NSLog(@"Email Error: %@",failureMessage); [[[UIAlertView alloc] initWithTitle:nil message:failureMessage delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil] show]; break; case MFMailComposeResultSent: default: break; } }
5
0
138
1w
A few questions on UWB on iOS
I’m thinking about making an app that requires two UWB things to work. I can’t seem to find anything about them and I haven’t got the money to just try it out. The questions are: how far can the iPhone be to a moving UWB chip to make a connection? can this work in the background? If so, is it intermittent? i need to be able to detect moving objects pretty reliably and have the app respond when it isn’t open. I guess a bit like the Covid tracking stuff. would the Apple frameworks allow for me to do this?
1
0
118
1w
Universal Link / AppLinks not opening the app
I am struggling getting universal links/applinks working for an App Store Event. I have been through the docs and various troubleshooting methods a number of times and cannot figure out why the universal link is not opening the app. Here's the apple-app-site-association file we have hosted on our website in .well-known (full url https://binaryformations.com/.well-known/apple-app-site-association): { "applinks": { "details": [{ "appIDs": ["com.BinaryFormations.UnderMyRoof"], "components": [{ "/": "/umrappevent/*", "comment": "Matches any URL whose path starts with /umrappevent/" }] }] } } Here's the configuration in the Associated Domains section in Xcode: I've also implemented scene(_ scene: UIScene, continue userActivity: NSUserActivity) in the window scene delegate. Just to see if it might solve the problem, I also implemented application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([any UIUserActivityRestoring]?) -> Void) -> Bool in the application delegate. I've been testing with this URL, among others, and the app is not being opened: https://binaryformations.com/umrappevent/9999 I've tried every troubleshooting technique I could find, including the once mentioned in TN3155 on debugging universal links (https://developer.apple.com/documentation/technotes/tn3155-debugging-universal-links) and everything seems to be as it should. Here's a summary of what I've tried so far: Checked that the CDN was returning the correct apple-app-site-association file: https://app-site-association.cdn-apple.com/a/v1/binaryformations.com Ran the following test with curl to verify there are no redirects (it returned with the response code of 200): curl -v https://binaryformations.com/.well-known/apple-app-site-association Using the above mentioned apple-app-site-association file as test.json, I randomly this test using swcutil and the URL seems to match fine: sudo swcutil verify -d binaryformations.com -j test.json -u https://binaryformations.com/umrappevent/9999 { s = applinks, a = com.BinaryFormations.UnderMyRoof, d = binaryformations.com }: Pattern "https://binaryformations.com/umrappevent/9999" matched. Associated Domains Development Diagnostics on the phone seem to indicate everything is okay with the URL: Last one: after installing a build from TestFlight on an iPhone (iOS 18), I see this in the swcutil_show.txt file from a sysdiagnose after trying the following link: https://binaryformations.com/umrappevent/9999 Service: applinks App ID: G52SXV33MH.com.BinaryFormations.UnderMyRoof App Version: 20240910.0 App PI: <LSPersistentIdentifier 0x4f8026100> { v = 0, t = 0x8, u = 0x474, db = 52D70E5E-2E19-4D2C-ADA7-1E6154CA1AFA, {length = 8, bytes = 0x7404000000000000} } Domain: binaryformations.com User Approval: unspecified Site/Fmwk Approval: denied Flags: Last Checked: 2024-09-11 15:36:17 +0000 Next Check: 2024-09-16 15:17:08 +0000 I'm sure I'm doing something silly that I just keep overlooking, but cannot seem to figure it out. Is there anything that's jumping out from all of this that I'm missing? Is there any way to get more information from the diagnostics as to why the rule was denied or anything else I should try? Thank you in advance.
2
0
211
2w
JSONEncoder: How to sort keys using "localizedStandardCompare"? (just like how Xcode 16 serialize a xcstrings file)
Hello, I'd like to ask a very fundamental question about JSONEncoder: how to sort keys in a specific order when encoding a dictionary to JSON text? I know there is an option called JSONEncoder.OutputFormatting.sortedKeys, but it sorts the keys only in lexicographic order. I want to sort the keys using a different comparator, such as String.localizedStandardCompare(_:), which achieves the "Finder-like" order. The reason why I ask this question is because I have a localization tool that works with String Catalog (xcstrings file, which is a JSON), but every time my tool serializes an xcstrings file, it always messes up the keys in lexicographic order (I used JSONEncoder + .sortedKeys). Meanwhile, Xcode 16 always serializes the string keys into the "Finder-like" order. As a result, my tool always generates a huge diff when manipulating the xcstrings even when making only a small modification to it. So I am wondering how Xcode 16 implements the String Catalog tool to serialize the JSON in "Finder-like" order. It would be great if JSONEncoder could do that too. Or, maybe I can use another serialization method to implement this behavior?
4
0
223
1w
AASA Status Not updating
Ive wrestled with this for days now. My first version of the app that included the app clip worked just fine, and then after using my new domains it says "Cannot Reach AASA File" I have refreshed many times, tried re-making the file and nothing works. When checking my domain, it has the right file and i validated it with branch and json validation. When clicking the app links for the app or the clip, they all work? This is frustrating because i cant create advanced app clips because it says it can't see my file Please Help, something is off here &lt;string&gt;applinks:etherialdimension.pages.dev&lt;/string&gt; &lt;string&gt;appclips:etherialdimension.pages.dev&lt;/string&gt; &lt;string&gt;applinks:etherealdimension.netlify.app&lt;/string&gt; &lt;string&gt;appclips:etherealdimension.netlify.app&lt;/string&gt; &lt;string&gt;applinks:www.etherealdimension.netlify.app&lt;/string&gt; &lt;string&gt;appclips:www.etherealdimension.netlify.app&lt;/string&gt;
1
0
190
Aug ’24
macOS Widgets won't launch with app group set
i'm working on an app which shares a swiftdata database between the main app and its widgets. prior to the sequoia/xcode 16 betas this was working fine with setting the same app group for app & widget targets. however, now whenever i try to run my main app from Xcode i get a user permission requestor saying " would like to access data from other apps.". this happens every time i run it. whenever the widget is started (via trying to place it on the desktop, or the widgetkit simulator etc) it exits immediately (i assume because it can't show the permission requestor?) if i disable the app group for the widget, it runs.. however, of course, i can't access the main app's database. i'm on sequoia beta 2 (24A5279h) and Xcode 16 beta 2 (16A5171r) note: while the widgetkit simulator is now present in sequoia beta 2, i haven't actually been able to successfully use it
5
1
472
Jul ’24
Error Reading Order File in Apple Wallet
Hello, I’m encountering an issue with Apple Wallet orders. Every time I send an order file to my iPhone, I get the error message: “Error reading order file.” Steps Taken: 1. Order File Structure: • I created an order.json file with the minimal required fields, including: • Order Type Identifier (created on the Apple Developer portal) • Merchant Identifier: (created on the Apple Developer portal) • Status: open • Other necessary fields, such as authenticationToken, createdAt, updatedAt, and payment. 2. Manifest and Signature: • A manifest.json file was generated with the SHA-256 hash for each file (e.g., order.json, images). • The manifest was signed using my Apple developer certificates: • Signer Certificate: signerCert.pem • Signer Key: signerKey.pem • WWDR Certificate: wwdr.pem • Verification of the manifest and signature was done using OpenSSL: • Command used: openssl smime -verify -in signature -inform DER -content manifest.json -noverify • The verification was successful, but the iPhone still returns the error. 3. File Packaging: • The final package includes the following files: • order.json • Images (e.g., gardenya_logo.png) • manifest.json • signature • The files were packaged into a .order file (renamed from .zip). 4. Apple WWDR Certificate: • I used Apple WWDR MP CA 1 - G1 for signing the package. Issue: Despite following all steps in the Apple documentation, the order file cannot be read by the iPhone, and the error message displayed is “Error reading order file.” Additional Information: • Manifest and Signature: Both files have been validated and match the package contents. • Apple Developer Certificates: Used valid Apple Developer certificates. • Order Schema: The order.json file follows Apple’s schema for orders. Could you please provide guidance on resolving this issue? Any suggestions on what could be causing the error, or additional steps to check, would be greatly appreciated. Thank you for your support!
3
0
135
1w
SiriTipUIView is missing the application name for an app shortcut
I'm working on an app for an accompanying toy that allows you do drop a marble on a self made track. As a nice bonus I wanted to make it possible to drop a marble using Siri Shortcuts, Siri or the HomePod. So the new iOS 16 App Intents work great for this. The App Intent documentation is bare, but I got the App Intent to work and it evens shows a custom error message when something goes wrong, However I now want to promote the feature. SiriTipUIView is meant for this, however I'm seeing an issue. The application name is missing from the tips UI, instead the phrase starts with a space. The code for the App Shortcuts struct MyAppShortcutsProvider: AppShortcutsProvider {     static var appShortcuts = [         AppShortcut(intent: DropMarbleIntent(), phrases: [             "\(.applicationName) drop marble",             "\(.applicationName) drop a marble",             "Drop a \(.applicationName)",             "Drop \(.applicationName)"         ])     ] } The code for the SiriTipUIView (just for testing) let tipView = SiriTipUIView() tipView.setIntent(intent: DropMarbleIntent()) tipView.sizeToFitUsingConstraints() tipView.allowsDismissal = true presentedSubscription = tipView.publisher(for: \.isPresented).sink { isPresented in if isPresented == false {     self.tableView.tableHeaderView = nil     } } tableView.tableHeaderView = tipView This happens on any iOS 16 simulator and on an iPhone 13 Pro running the iOS 16 release version. Am I missing something, or should I report a bug using feedback?
4
1
1.5k
Sep ’22
ApplicationTokens changing
We persist ApplicationTokens in a storage container that ShieldConfigurationExtension has access to. In rare, cases all the ApplicationTokens for a user seem to change. We know this because the Application parameter passed into configuration(shielding application: Application) -> ShieldConfiguration function has a Token that does not match (using == ) any of the ones we are persisting in storage. Interestingly, the persisted ones still work, so I don't believe storage has gotten corrupted or anything. We can use them to add or remove shields, we can use them to display labels of the apps they represent, etc. But they don’t match what’s passed into the ShieldConfiguration extension. If the user goes into the FamilyPicker at this point and selects an app of a token that we are already persisting, the FamilyPickerSelection will have a token matching the new one that is passed into ShieldConfigurationExtension, not the one we persisted when they last selected that app. This leads me to believe the tokens are updated/rotated in some cases. When and why does this happen, and how can we handle it gracefully?
4
4
1.1k
Jun ’23
NSMetaData Object IOS
I've been trying to access the NSMetaData information for mb4 objects that I legally downloaded from third party websites without DRM protection. I posted a request in the app forum before and didn't receive any responses from anyone, so it occurred to me to use the example apple code provided on NSMetaData Objects. Steps to reproduce: download the "simpleiclouddocument" example and changed the document extension to Mb4. It seems the query fails because the documents are outside the application directory, so I expanded the search scope to include "NSMetaDataQueryAccessibleExternalDocumentsScope" and the files are still not found. I have the URL of the file that I want the MetaData for. I understand that NSMetaData has an init object that works with a URL but it only works on MacOS and not iOS. I have alternatively tried using LPLinkPresentation and AVMetdataItem but these two alternatives appear to limit the metadata fields I can access and there is no additional object data on how to expand the links to access the other metadata items associated with the file, specifically the Author field as Mb4 files have authors in addition to other audio metadata settings. If there is additional information somewhere on those two classes that identifies how I can access the rest of the metadata fields that would likewise correct my problem.
3
0
144
2w
App crashes a lot with RunCurrentEventLoopInMode
I have developed and distributed a Mac app on App Store. From the Organizer in Xcode, I noticed that it has a lot of crashes. And 90% of these crashes is the same crash as following: Thread 0 Crashed: 0 libsystem_kernel.dylib 0x00007ff81ce27112 __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007ff81ce5d233 pthread_kill + 263 2 libsystem_c.dylib 0x00007ff81cda9d10 abort + 123 3 libc++abi.dylib 0x00007ff81ce1a0b2 abort_message + 241 4 libc++abi.dylib 0x00007ff81ce0b1fd demangling_terminate_handler() + 266 5 libobjc.A.dylib 0x00007ff81cd08509 _objc_terminate() + 96 6 libc++abi.dylib 0x00007ff81ce194d7 std::__terminate(void (*)()) + 8 7 libc++abi.dylib 0x00007ff81ce19488 std::terminate() + 56 8 libdispatch.dylib 0x00007ff81cca6cdd _dispatch_client_callout + 28 9 libdispatch.dylib 0x00007ff81cca9746 _dispatch_continuation_pop + 460 10 libdispatch.dylib 0x00007ff81ccbaa5a _dispatch_source_invoke + 2150 11 libdispatch.dylib 0x00007ff81ccb3518 _dispatch_main_queue_callback_4CF + 759 12 CoreFoundation 0x00007ff81cf625d9 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 13 CoreFoundation 0x00007ff81cf236ae __CFRunLoopRun + 2752 14 CoreFoundation 0x00007ff81cf2252d CFRunLoopRunSpecific + 563 15 HIToolbox 0x00007ff825b403e1 RunCurrentEventLoopInMode + 292 16 HIToolbox 0x00007ff825b40137 ReceiveNextEventCommon + 587 17 HIToolbox 0x00007ff825b3fed5 _BlockUntilNextEventMatchingListInModeWithFilter + 70 18 AppKit 0x00007ff81f94d8f0 _DPSNextEvent + 886 19 AppKit 0x00007ff81f94bf5c -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1411 20 AppKit 0x00007ff81f93e359 -[NSApplication run] + 586 21 AppKit 0x00007ff81f9121f8 NSApplicationMain + 816 How to fix this issue?
4
0
184
2w
Live Activity for Workout app on Apple Watch
Hi, We’ve developed a workout app with a Live Activity feature to help users launch the mirroring view on iPhone, similar to the built-in workout app for biking activities. While Live Activities are now available on watchOS 11, the integration feels a bit off for our Workout app. Is there a way to disable or exclude our Live Activity from appearing on watchOS? Currently, when a user starts a workout, the Live Activity appears at the bottom of the screen, requiring users to tap the screen before they can use our app. The built-in Workout app doesn’t have this issue. Additionally, our Live Activity appears in the Smart Stack, duplicating content with the built-in Workout Live Activity. We’re unsure if we missed any keys or settings to exclude Live Activity from watchOS.
4
0
294
Aug ’24
iOS 17.4.1 Safari extension issues
Since updating to iOS v17.4.1 our safari extension no longer functions as it used to We are experiencing issues where our content script is not getting initialized, On devices running iOS 17.4.1, the content script included in our extension does not appear to run. There are no logs from the content script in the console, whereas on other versions and devices, it operates as expected. Our Extension relies con communication between the background and content scripts in order for us to render various popups to our users, based on our logs as of iOS 17.4.1 this communication is not successful, we can see messages being sent from the background script but as mentioned above nothing on the content script side. This behavior happens majority of the time and on random sites, sometimes opening the same site in a new tab would work but not always. There are also times where we would only receive our popups after opening the safari menu and interacting with our extension via this menu. Please assist with a way forward
33
14
4.5k
Apr ’24
AppIntents Parameter requestValue not working in iOS 18 when parameter is not in parameterSummary
In iOS 18, the requestValue method no longer works when the parameter it is called on is not included in the parameterSummary of an AppIntent. This issue causes the app to fail to present a prompt for the user to select a value, resulting in an error with the message: Domain=NSCocoaErrorDomain Code=4099 "The connection from pid 40685 on anonymousListener or serviceListener was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid." Steps to Reproduce: Create a simple AppIntent with the following code: import AppIntents struct Intent: AppIntent { static let title: LocalizedStringResource = "Intent" static var parameterSummary: some ParameterSummary { Summary("Test \(\.$category)") {} } @Parameter(title: "Category") private var category: CategoryEntity? @Parameter(title: "Hidden Category") private var hidden: CategoryEntity? @MainActor func perform() async throws -> some ReturnsValue<CategoryEntity?> { var result: CategoryEntity? do { result = try await $hidden.requestValue("Select category") // Doesn't work since iOS 18 as $hidden is not set in parameterSummary } catch { print("\(error)") } return .result(value: result) } } Run the code on a device with iOS 18. Observe that the requestValue method fails to present the selection prompt and instead throws an error. Expected Results: The app should successfully present a prompt for the user to select a value for the hidden parameter using requestValue, even if the parameter is not included in the parameterSummary. Actual Results: The app fails to present the selection prompt and throws an error, making it impossible to use requestValue for parameters not included in parameterSummary. Version/Build: iOS 18.0 Configuration: Tested on various devices running iOS 18. Is there a change in the API that I might have missed?
2
2
339
Aug ’24
ControlWidgetToggle state when parent app is terminated
I have programmed a ControlWidgetToggle which controls a recording state in our main app, that can be on (recording) or off (not recording). The recording can also be controlled from inside the main app, and there we call ControlCenter.shared.reloadControls(ofKind: "") to update the ControlWidgetToggle state when the recording state changes. Now this all works great, except for the situation in which the user terminates the app (for example using the app switcher screen). Then of course the recording will stop. I however have no idea how to update the state of the ControlWidgetToggle in this case, it will stay in the recording state since it does not know that the recording has been stopped. The applicationWillTerminate delegate method of the AppDelegate will not be called in such a case. Does someone has an idea how to update the state of the ControlWidgetToggle once the parent app has been terminated?
1
0
157
2w