Is there a trick to getting the new Live Activities on Apple Watch working via the simulator? I have an iPhone paired to a watch simulator, but live activities created on the phone aren't appearing on the watch Smart Stack.
It looks like maybe the Smart Stack isn't functional on the watch simulator, as there are a bunch of blank tiles where the Smart Stack should be.
General
RSS for tagExplore the various UI frameworks available for building app interfaces. Discuss the use cases for different frameworks, share best practices, and get help with specific framework-related questions.
Post
Replies
Boosts
Views
Activity
Hello everyone, I am using the new AccessorySetupKit, and whenever I try to remove an accessory I sometimes get an alert asking me to make sure if I want to remove the accessory from my device. The problem is that this alert sometimes shows up, and sometimes it does not. The removal of the accessory does work, it is just that the alert is not predictable. Is this expected behavior? How can we “predict” when it will show up and when it will not?
Hello,
I am building a web app using Mapkit JS, and have something up an running where I can add markers and annotate places with Place ID (I followed along with the WWDC24 video).
However occasionally, while I'm doing nothing on the browser, I get an runtime error with the following error trace (from developer tools in Chrome).
===
Uncaught TypeError: Cannot read properties of null (reading 'tint')
at get tint (mapkit.core.annotations.d43c86.js:2:97102)
at get colorScheme (mapkit.core.annotations.d43c86.js:2:81602)
at e.exports.PlaceCardController._renderPlaceIframe (mapkit.core.map.536988.js:2:214785)
at e.exports.PlaceCardController.update (mapkit.core.map.536988.js:2:212978)
at e.exports.PlaceCardController._handleConfigChanged (mapkit.core.map.536988.js:2:213284)
at _handleConfigChangedListener (mapkit.core.map.536988.js:2:212679)
at n.dispatchEvent (mapkit.core.js:2:16624)
at mapkit.core.js:2:10799
===
It is completely random, and not a result of any browser / Map interaction.
Seems to be an issue in mapkit.core, and related to Place IDs.
Can anyone help with this?
I'm adding support for Genmoji to my app but it's unclear to me if this is something that should be called manually in code to insert an adaptive image glyph or if this is something that the system calls when the user inserts a Genmoji / adaptive image glyph object (ie. sticker) into the UITextView.
I created a Radar for this FB14766095, but thought I would add it here for extra visibility, or if anyone else had any thoughts on the issue.
Basic Information
Please provide a descriptive title for your feedback:
iOS 18 hit testing functionality differs from iOS 17
What type of feedback are you reporting?
Incorrect/Unexpected Behavior
Description:
Please describe the issue and what steps we can take to reproduce it:
We have an issue in iOS 18 Beta 6 where hit testing functionality differs from the expected functionality in iOS 17.5.1 and previous versions of iOS.
iOS 17: When a sheet is presented, the hit-testing logic considers subviews of the root view, meaning the rootView itself is rarely the hit view.
iOS 18: When a sheet is presented, the hit-testing logic changes, sometimes considering the rootView itself as the hit view.
Code:
import SwiftUI
struct ContentView: View {
@State var isPresentingView: Bool = false
var body: some View {
VStack {
Text("View One")
Button {
isPresentingView.toggle()
} label: {
Text("Present View Two")
}
}
.padding()
.sheet(isPresented: $isPresentingView) {
ContentViewTwo()
}
}
}
#Preview {
ContentView()
}
struct ContentViewTwo: View {
@State var isPresentingView: Bool = false
var body: some View {
VStack {
Text("View Two")
}
.padding()
}
}
extension UIWindow {
public override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
/// Get view from superclass.
guard let hitView = super.hitTest(point, with: event) else { return nil }
print("RPTEST rootViewController = ", rootViewController.hashValue)
print("RPTEST rootViewController?.view = ", rootViewController?.view.hashValue)
print("RPTEST hitView = ", hitView.hashValue)
if let rootView = rootViewController?.view {
print("RPTEST rootViewController's view memory address: \(Unmanaged.passUnretained(rootView).toOpaque())")
print("RPTEST hitView memory address: \(Unmanaged.passUnretained(hitView).toOpaque())")
print("RPTEST Are they equal? \(rootView == hitView)")
}
/// If the returned view is the `UIHostingController`'s view, ignore.
print("MTEST: hitTest rootViewController?.view == hitView", rootViewController?.view == hitView)
print("MTEST: -")
return hitView
}
}
Looking at the print statements from the provided sample project:
iOS 17 presenting a sheet from a button tap on the ContentView():
RPTEST rootViewController's view memory address: 0x0000000120009200
RPTEST hitView memory address: 0x000000011fd25000
RPTEST Are they equal? false
MTEST: hitTest rootViewController?.view == hitView false
RPTEST rootViewController's view memory address: 0x0000000120009200
RPTEST hitView memory address: 0x000000011fd25000
RPTEST Are they equal? false
MTEST: hitTest rootViewController?.view == hitView false
iOS 17 dismiss from presented view:
RPTEST rootViewController's view memory address: 0x0000000120009200
RPTEST hitView memory address: 0x000000011fe04080
RPTEST Are they equal? false
MTEST: hitTest rootViewController?.view == hitView false
RPTEST rootViewController's view memory address: 0x0000000120009200
RPTEST hitView memory address: 0x000000011fe04080
RPTEST Are they equal? false
MTEST: hitTest rootViewController?.view == hitView false
iOS 18 presenting a sheet from a button tap on the ContentView():
RPTEST rootViewController's view memory address: 0x000000010333e3c0
RPTEST hitView memory address: 0x0000000103342080
RPTEST Are they equal? false
MTEST: hitTest rootViewController?.view == hitView false
RPTEST rootViewController's view memory address: 0x000000010333e3c0
RPTEST hitView memory address: 0x000000010333e3c0
RPTEST Are they equal? true
MTEST: hitTest rootViewController?.view == hitView true
You can see here ☝️ that in iOS 18 the views have the same memory address on the second call and are evaluated to be the same. This differs from iOS 17.
iOS 18 dismiss
RPTEST rootViewController's view memory address: 0x000000010333e3c0
RPTEST hitView memory address: 0x0000000103e80000
RPTEST Are they equal? false
MTEST: hitTest rootViewController?.view == hitView false
RPTEST rootViewController's view memory address: 0x000000010333e3c0
RPTEST hitView memory address: 0x0000000103e80000
RPTEST Are they equal? false
MTEST: hitTest rootViewController?.view == hitView false
The question I want to ask:
Is this an intended change, meaning the current functionality in iOS 18 is expected?
Or is this a bug and it's something that needs to be fixed?
As a user, I would expect that the hit testing functionality would remain the same from iOS 17 to iOS 18.
Thank you for your time.
Apparently, the half-a-sec boxy notification issue remains up until now???
Please help fix the bug, Apple Dev. how come an issue from ios 16 still happening now in ios 18?
reference: https://www.reddit.com/r/ios/s/Qx116rGBzM
Now that we are finally able to customize our home screen, can you disable the auto relocation feature? Making it extremely difficult to customize home screen when things are still moving around automatically. Thanks.
Is there currently an option to make generated asset symbols public?
If not, would it be possible to set the generated asset symbol so they are public. It's quite common to have an apps design system implemented in a separate framework. Currently the generate assets symbols is useless for this as they can't be access in the framework consumer.
It would be great to add it to this new dropdown in Xcode 16 or along side it. (113704993 in the release notes) So the options would be Internal, Public and Off. This should affect the symbols, the extensions and the framework support.
(There's a post on the swift forums about this as well here: https://forums.swift.org/t/generate-images-and-colors-inside-a-swift-package/65674)
The documentation doesn't state how to get the new APNs push token that is associated with a Live Activity that is started via an APNs push notification. I have been able to get the new token by listening to all instances of the Live Activities for my attribute type, but it makes me wonder how the "input-push-token" option for iOS 18 is supposed to work.
Is there another way to retrieve the newly created Live Activity push token when using "input-push-token"?
Hi
Is it possible to render webview in Widget?
Basically i want to show some content of website in Widget on homescreen using webview.
I tried to use WKWebview in WidgetView, but it's not rendering .
Thanks with regards
iOSProfessionals
Hi,
is there any description/documentation about what can not be used as SwiftData attributes?
I do not mean things which cause issues at compile time, like having a type which is not Codeable. But rather I am looking for info which things to avoid, if you do not want to run into application crashes in modelContext.save(). Like for example having an enum which as an optional associated value as an attribute type (crashes on save is the associated value is nil).
Anybody seen any documentation about that? Or tech notes?
Thanks in advance for any hints :-).
Cheers, Michael
We are trying to build a video recording app using AVFoundation and AVCaptureDevice.
No custom settings are used like iso, exposure duration. All the settings are kept to auto.
But when video is captured using front camera and 1080x1920 dimensions, the video captured from the app and front native camera does not match.
In settings i have kept video setting as 30 fps 1080x1920.
The video captured from the app includes more area than the native app. Also some values like iso, exposure duration does not match.
So is there any way to capture video exactly same as native camera using AVFoundation and AVCaptureDevice.
I have attached screenshots from video for reference.
Native
AVCapture
Unable to record and play the new contacts permission system dialog.
App: https://developer.apple.com/documentation/contacts/accessing-a-person-s-contact-data-using-contacts-and-contactsui
func handleContactsAccessAlert() {
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
let allowButton = springboard.buttons["Allow Full Access"]
allowButton.tap()
let access6ContactsButton = springboard.alerts["Allow full access to 6 contacts?"].scrollViews.otherElements.buttons["Allow"]
access6ContactsButton.tap()
}
func handleContactsPermissionAlert() {
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
let allowButton = springboard.buttons["Continue"]
if allowButton.exists {
allowButton.tap()
sleep(5)
handleContactsAccessAlert()
}
}
func testContactPermissions() {
let app = XCUIApplication()
app.launch()
app.buttons["Request Access"].tap()
sleep(5)
handleContactsPermissionAlert()
sleep(5)
app.collectionViews/*@START_MENU_TOKEN@*/.staticTexts["Kate Bell"]/*[[".cells.staticTexts[\"Kate Bell\"]",".staticTexts[\"Kate Bell\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/.tap()
}
I have created an iOS 18 Control Center Widget that launches my app. However I am not able to detect it in AppDelegate.swift. I have created custom scheme funRun://beginRun in Target => Info => URL Types URL Types setup in Xcode
This method in AppDelegate.swift does not fire at all and I get this error in console:
Failed to open URL runFun://beginRun: Error Domain=NSOSStatusErrorDomain Code=-10814 "(null)" UserInfo={_LSLine=279, _LSFunction=-[_LSDOpenClient openURL:fileHandle:options:completionHandler:]}``
`
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
// this does not fire
print("Scheme \(url.scheme)")
print("Host \(url.host)")
return true
}`
I tried this answer to no avail: iOS 18 Control Widget that opens a URL
Even adding EnvironmentValues().openURL(url) as suggested here did not help.
@MainActor
func perform() async throws -> some IntentResult & OpensIntent {
let url = URL(string: "funRun://beginRun")!
EnvironmentValues().openURL(url)
return .result(opensIntent: OpenURLIntent(url))
}
Here is my extension code: My goal is to detect the url string from the request, so I can decide which screen to launch from AppDelegate's open url method. When I test this with iOS 18 RC it does not work either in simulator or on real device
import AppIntents
import SwiftUI
import WidgetKit
@available(iOS 18.0, watchOS 11.0, macOS 15.0, visionOS 2.0, *)
struct StartRunControl: ControlWidget {
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(
kind: "name.funRun.StartRun",
provider: Provider()
) { value in
ControlWidgetButton("Hello",
action: MyIntent()) { hi in
Label("Start", systemImage: "sun.min.fill")
}
}
.displayName("Start run")
.description("Opens a run screen.")
}
}
@available(iOS 18.0, watchOS 11.0, macOS 15.0, visionOS 2.0, *)
extension StartRunControl {
struct Provider: ControlValueProvider {
var previewValue: Bool {
false
}
func currentValue() async throws -> Bool {
let isRunning = true // Check if the timer is running
return isRunning
}
}
}
@available(iOS 18.0, watchOS 11.0, macOS 15.0, visionOS 2.0, *)
struct MyIntent: AppIntent {
static let title: LocalizedStringResource = "My Intent"
static var openAppWhenRun: Bool = true
init() {}
@MainActor
func perform() async throws -> some IntentResult & OpensIntent {
let url = URL(string: "funRun://beginRun")!
EnvironmentValues().openURL(url)
return .result(opensIntent: OpenURLIntent(url))
}
}
I even checked info.plist and it seems okay.
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>beginRun</string>
<key>CFBundleURLSchemes</key>
<array>
<string>funRun://beginRun</string>
</array>
</dict>
</array>
Does anyone know where the problem might be? Thanks!
With the newest iPad Pro and iPad Air's, the front facing camera sits on the long horizontal edge, which is different from the previous version which had the camera on the shorter top edge. We have an app that needs to put a UI item near the camera. Is there a way of detecting where the front facing camera is on iOS?
I have tried doing simple resolution checks, i.e,
if width == ipadProWidth || width == ipadAirWidth {
do2024iPadProLayout()
} else {
doStandardiPadLayout()
}
But this doesn't feel like the nicest way to do this check, because it's liable to break moving forward, and theres the possibility Apple release more devices with the camera on the horizontal edge.
Any help here is appreciated!
I'm building a MacOS app which reads a lot of PDFs in the background. Some of these PDF's have an embedded font which is not installed on the system. In such cases the app shows a popup asking whether to Download or Skip the font. This seems to be a PDFKit behavior because I see the same behavior when I open the file in Preview (see screenshot)
This behavior is disruptive to the user experience and I'd like to be able to disable font downloads. However I don't see any option in the PDFKit API to do so. Any ideas?
My app needs to send iMessages with an attached data file. The view comes up modally and the user needs to press the send button. When the button is tapped the error occurs and the attachment and message is not delivered.
I have tried three implementations of UIViewControllerRepresentable for MFMessageComposeViewController that have worked for iOS 15 and 16, but not 17. If I make the simplest app to show the problem, it will reliably fail on all iOS versions tested.
If I remove the attachment, the message gets sent. In contrast, the equivalent UIViewControllerRepresentable for email works perfectly every time. After struggling for weeks to get it to work, I am beginning to believe this is a timing error in iOS. I have even tried unsuccessfully to include dispatch queue delays.
Has anybody else written a swiftUI based app that can reliably attach a file to an iMessage send?
UIViewControllerRepresentable:
import SwiftUI
import MessageUI
import UniformTypeIdentifiers
struct AttachmentData: Codable {
var data:Data
var mimeType:UTType
var fileName:String
}
struct MessageView: UIViewControllerRepresentable {
@Environment(\.presentationMode) var presentation
@Binding var recipients:[String]
@Binding var body: String
@Binding var attachments:[AttachmentData]
@Binding var result: Result<MessageComposeResult, Error>?
func makeUIViewController(context: Context) -> MFMessageComposeViewController {
let vc = MFMessageComposeViewController()
print("canSendAttachments = \(MFMessageComposeViewController.canSendAttachments())")
vc.recipients = recipients
vc.body = body
vc.messageComposeDelegate = context.coordinator
for attachment in attachments {
vc.addAttachmentData(attachment.data, typeIdentifier: attachment.mimeType.identifier, filename: attachment.fileName)
}
return vc
}
func updateUIViewController(_ uiViewController: MFMessageComposeViewController, context: Context) {
}
func makeCoordinator() -> Coordinator {
return Coordinator(presentation: presentation, result: $result)
}
class Coordinator: NSObject, MFMessageComposeViewControllerDelegate {
@Binding var presentation: PresentationMode
@Binding var result: Result<MessageComposeResult, Error>?
init(presentation: Binding<PresentationMode>, result: Binding<Result<MessageComposeResult, Error>?>) {
_presentation = presentation
_result = result
}
func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWith result: MessageComposeResult) {
defer {
$presentation.wrappedValue.dismiss()
}
switch result {
case .cancelled:
print("Message cancelled")
self.result = .success(result)
case .sent:
print("Message sent")
self.result = .success(result)
case .failed:
print("Failed to send")
self.result = .success(result)
@unknown default:
fatalError()
}
}
}
}
SwiftUI interface:
import SwiftUI
import MessageUI
struct ContentView: View {
@State private var isShowingMessages = false
@State private var recipients = ["4085551212"]
@State private var message = "Hello from California"
@State private var attachment = [AttachmentData(data: Data("it is not zip format, however iMessage won't allow the recipient to open it if extension is not a well-known extension, like .zip".utf8), mimeType: .zip, fileName: "test1.zip")]
@State var result: Result<MessageComposeResult, Error>? = nil
var body: some View {
VStack {
Button {
isShowingMessages.toggle()
} label: {
Text("Show Messages")
}
.sheet(isPresented: $isShowingMessages) {
MessageView(recipients: $recipients, body: $message, attachments: $attachment, result: $result)
}
.onChange(of: isShowingMessages) { newValue in
if !isShowingMessages {
switch result {
case .success(let type):
switch type {
case .cancelled:
print("canceled")
break
case .sent:
print("sent")
default:
break
}
default:
break
}
}
}
}
}
}
#Preview {
ContentView()
}
Before iPadOS 18, I was using hidesBottomBarWhenPushed, and it worked beautifully.
Now, it's broken/not working.
How are we supposed to hide the new tab bar nowadays?
I am looking to use the iOS share sheet in my app where the user can send an invite link to friends, however I want to limit the number of times they can do this.
Is it possible to limit the number of recipients who you can share an item using the share sheet, or if there any sort of post-feedback sent from the share sheet back to the app once the share sheet is closed?
ERROR ITMS-90349: "Invalid Info.plist value. The value of the EXExtensionPointldentifier key, com.apple.contact.provider.extension, in the Info.plist of "MainApp.app/Extensions/ContactProviderExtension.appex" is invalid.
We were working on new iOS18 Contacts Provider extension and when try to test the feature in testflight we were unable to submit the build and getting the above error. The extensionPointldentifier 'com.apple.contact.provider.extension' was auto generated by xcode and apple doc mentioned the same value to use for Contacts Provider extension support. But it is not accepting in testflight.
https://developer.apple.com/documentation/contactprovider/contactproviderextension
Any help will be appreciated.