Why is the pitch slider always visible in the SwiftUI tvOS map view? It doesn't even appear to be supported there, let alone the fact that I specify mapControlVisibility(.hidden). Am I missing something or is Apple? See attached screenshot. This really messes up my UI.
Here is my code:
import SwiftUI
import MapKit
struct ContentView: View {
@State var position = MapCameraPosition.region(MKCoordinateRegion(
center: CLLocationCoordinate2D(latitude: 37.7749, longitude: -122.4194),
span: MKCoordinateSpan(latitudeDelta: 0.05, longitudeDelta: 0.05)))
var body: some View {
Map(position: $position)
.mapControlVisibility(.hidden)
.mapStyle(.standard(pointsOfInterest: .including(.airport)))
}
}
Explore 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.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
DESCRIPTION OF PROBLEM
When using SwiftUI’s TextField or TextEditor on iPadOS, a persistent gray or default system material bar appears at the bottom of the screen. This gray bar is not present in Apple’s native apps (such as Notes, Mail, Messages) or in third-party apps like ChatGPT and Beeper
STEPS TO REPRODUCE
Create a TextField or TextEditor. Run the code, click on it, without software keyboard enabled.
Can the SwiftUI document architecture
Take a file as read-only; never to be written out
Take files too large for memory (multi-MB, or even GB)
I wouldn't want the system to read a gigabyte size file into memory by default. If the system can use a memory-mapped Data as the representation, that'll be something I can make do. It would be even better if I could tell the system that I'll handle all the reading, all I need from it is a reference to the file's location on disk.
Topic:
UI Frameworks
SubTopic:
SwiftUI
I have a controller that displays a pdf using UIDocumentInteractionController as the presented view.
When users open it up, it shows fine.
User gets the app backgrounded and session timed out.
After timed out, when the app is brought to foreground, I bring our loginVC by removing the old VC used to show the UIDocumentInteractionController.
All the crashes are happening at this point.
I am not able to reproduce it, but our alert systems show we have crashes happening.
The code that shows the pdf is straight forward
documentViewController = UIDocumentInteractionController()
documentViewController?.delegate = self
documentViewController?.url = url
documentViewController?.presentPreview(animated: true)
and we reset it to nil in delegate documentInteractionControllerDidEndPreview
Based on the crash trace, it seems like the crash happens when our login VC replaces it and only when pdf was displayed. The reason of stressing ONLY because when we have other viewcontroller present and they are removed in a similar way, we do not see any issue.
So we always replace first and then add a new one
childViewController.willMove(toParent: nil)
childViewController.viewIfLoaded?.removeFromSuperview()
childViewController.removeFromParent()
addChild(childViewController)
view.addSubview(childViewController.view)
childViewController.view.frame = view.bounds
childViewController.didMove(toParent: self)
Raised a ticket with Apple, but I haven't heard back, and it's been a month. Posting here in case anyone experiences the same and has any solutions. I saw some related posts, and solution was to remove the pdf the moment the app goes to the background, but I am trying to find some alternate solution if possible.
Topic:
UI Frameworks
SubTopic:
UIKit
Hello, the LocalizedStringKey does not work in the live activity. What do you suggest me to use in order to get localization in the live activity?
I am developing an application which make use of 2 ornaments anchored to a volumetric window, one used a toolbar and one to display different views.
The problem I am facing consistently is that the ornaments seems to scale up or down after moving the volume using the OS handle or starting a GroupActivity session.
This first image shows the ornaments as soon as I started the app, no dragging nor group activities:
This second images shows them as soon as I join a group activity session:
The map, which might seem smaller, has not been touched and has always the same scale.
In this last image I had just dragged the entire volume using the OS toolbar, resulting in the ornaments scaling down:
This is how the volume and the ornaments are declared:
WindowGroup(id: "CityVolume") {
let cityVM = CityViewModel(volumeSize: CityView.initialVolumeSize)
CityView(cityVM: cityVM)
.ornament(attachmentAnchor: .scene(.bottomFront)) {
HStack {
TourismChartsButton()
LandmarksListButton()
CenterMapButton()
ToggleImmersiveSpaceButton()
TrafficDataButton()
BusLinesButton()
}
.padding()
.offset(z: 10)
.rotation3DEffect(Angle(degrees: 15), axis: (x: 1.0, y: 0.0, z: 0.0))
}
.ornament(attachmentAnchor: .scene(.back)) {
ZStack {
if AppModel.Instance.tourismVM.isChartViewVisible {
TourismChartsView()
}
if AppModel.Instance.busLinesVM.isDataViewEnabled {
BusLineView()
}
}
}
.task(observeGroupActivity)
.onAppear {
appModel.cityVM = cityVM
}
}
.windowStyle(.volumetric)
.windowResizability(.contentSize)
.volumeWorldAlignment(.gravityAligned)
.defaultSize(CityView.initialVolumeSize, in: .meters)
It happens also without starting a SharePlay session, but not as frequently as during SharePlay. Experienced the same behaviour with toolbars.
Am I doing something wrong with how I created the ornaments? Am I missing something?
Title: Frequent SIGSEGV crashes in QuartzCore's copy_image (iOS 18.4)
We're experiencing numerous crashes with the following signature:
Exception Codes: fault addr: 0x00000000000000e0
Crashed Thread: 0
Thread 0
0 QuartzCore CA::Render::copy_image(CGImage*, CGColorSpace*, unsigned int, double, double) + 1972
1 QuartzCore CA::Render::copy_image(CGImage*, CGColorSpace*, unsigned int, double, double) + 1260
2 QuartzCore CA::Render::prepare_image(CGImage*, CGColorSpace*, unsigned int, double) + 24
3 QuartzCore CA::Layer::prepare_contents(CALayer*, CA::Transaction*) + 220
4 QuartzCore CA::Layer::prepare_commit(CA::Transaction*) + 284
5 QuartzCore CA::Context::commit_transaction(CA::Transaction*, double, double*) + 488
6 QuartzCore CA::Transaction::commit() + 644
7 UIKitCore ___34-[UIApplication _firstCommitBlock]_block_invoke_2 + 36
8 CoreFoundation ___CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 28
9 CoreFoundation ___CFRunLoopDoBlocks + 352
10 CoreFoundation ___CFRunLoopRun + 868
11 CoreFoundation _CFRunLoopRunSpecific + 572
12 GraphicsServices _GSEventRunModal + 168
13 UIKitCore -[UIApplication _run] + 816
14 UIKitCore _UIApplicationMain + 336
15 kugou _main + 132
16 dyld __dyld_process_info_create + 33284
Observations:
1.Crashes consistently occur in Core Animation's image processing pipeline
2.100% of occurrences are on iOS 18.4 devices
3.Crash signature suggests memory access violation during image/copy operations
4.Not tied to any specific device model
Questions for Apple:
1.Is this crash pattern recognized as a known issue in iOS 18.4?
2.Are there specific conditions that could trigger SEGV_ACCERR in CA::Render::copy_image?
3.Could this be related to color space handling or image format requirements changes?
4.Any recommended workarounds while waiting for a system update?
I am facing same issue with major crash while coming out from this function.
Basically using collectionView.dequeReusableCell with size calculation.
func getSizeOfFavouriteCell(_ collectionView: UICollectionView, at indexPath: IndexPath, item: FindCircleInfoCellItem) -> CGSize { guard let dummyCell = collectionView.dequeueReusableCell( withReuseIdentifier: TAButtonAddCollectionViewCell.reuseIdentifier, for: indexPath) as? TAButtonAddCollectionViewCell else { return CGSize.zero }
dummyCell.title = item.title
dummyCell.subtitle = item.subtitle
dummyCell.icon = item.icon
dummyCell.layoutIfNeeded()
var targetSize = CGSize.zero
if viewModel.favoritesDataSource.isEmpty.not,
viewModel.favoritesDataSource.count > FindSheetViewControllerConstants.minimumFavoritesToDisplayInSection {
targetSize = CGSize(width: collectionView.frame.size.width / 2, height: collectionView.frame.height)
var estimatedSize: CGSize = dummyCell.systemLayoutSizeFitting(targetSize)
if estimatedSize.width > targetSize.width {
estimatedSize.width = targetSize.width
}
return CGSize(width: estimatedSize.width, height: targetSize.height)
}
}
We have resolve issue with size calculation with checking nil. Working fine in xcode 15 and 16+.
Note: Please help me with reason of crash? Is it because of xCode 16.2 onwards **strict check on UICollectionView **
I have a UITextView being added at runtime to a UIImageView as the result of doing text recognition. It's set to be editable = NO and selectable = YES. When I set the text and select it, it asks the delegate for the menu to display via:
textView:editMenuForTextInRange:suggestedActions:
The suggested items contains many UIAction and UICommand objects that have private methods or do not have the destructive attribute set, yet they are destructive. Some of these are:
promptForReplace:
transliterateChinese:
_insertDrawing:
_showTextFormattingOptions:
I need to return a menu that has only non-destructive commands in it.
First, why isn't UITextView sending only non-destructive suggested commands when its editable is NO?
Second, how can I filter the array of suggested commands when it's impossible to know if they're destructive (as some are missing that attribute)?
In addition to that, even non-destructive commands are causing an unrecognized selector exception, such as the Speak command, which it is sending to my view controller instead of to the UITextView, which is the only thing that knows what the text is that it should speak.
Topic:
UI Frameworks
SubTopic:
UIKit
I want to record screen ,and than when I call the method stopCaptureWithHandler:(nullable void (^)(NSError *_Nullable error))handler to stop recording and saving file. before call it,I check the value record of RPScreenRecorder sharedRecorder ,the value is false , It's weird! The screen is currently being recorded !
I wonder if the value of [RPScreenRecorder sharedRecorder].record will affect the method stopCaptureWithHandler:
-(void)startCaptureScreen {
[[RPScreenRecorder sharedRecorder] startCaptureWithHandler:^(CMSampleBufferRef _Nonnull sampleBuffer, RPSampleBufferType bufferType, NSError * _Nullable error) {
//code
} completionHandler:^(NSError * _Nullable error) {
//code
}];
}
- (void)stopRecordingHandler {
if([[RPScreenRecorder sharedRecorder] isRecording]){
// deal error .sometime isRecording is false
}else {
[[RPScreenRecorder sharedRecorder] stopCaptureWithHandler:^(NSError * _Nullable error) {
}];
}
}
here are my code.
We've seen a spike in crashes on iOS 18.4 across both iPhone & iPad. We can't reproduce it, but it looks like it happens when the app goes into the background.
Crash Log
I have a few crash report from TestFlight with this context and nothing else. No symbols of my application.
Crash report is attached.
crashlog.crash
It crashes at 16H25 (local time paris) and a few minutes after (8) I see the same user doing task in background (they download data with a particular URL in BGtasks) with a Delay that is consistant with a background wait of 5 or 7 minutes.
I have no more information on this crash and by the way Xcode refuses to load it and shows an error. ( I did a report via Xcode for this).
Anyone know how to reduce the padding between list section header (plain style) and search bar? I have tried all available method on google but none work. The default list style does not have this big padding/space between the section header and the search bar.
struct Demo: View {
@State private var searchText: String = ""
var body: some View {
NavigationStack {
List {
Section {
ForEach(0..<100) { index in
Text("Sample value for \(index)")
}
} header: {
Text("Header")
.font(.headline)
}
}
.listStyle(.plain)
.navigationTitle("Demo")
.navigationBarTitleDisplayMode(.inline)
.searchable(text: $searchText)
}
}
}
为什么App 上传testFlight之后。无法通过NFC的方式唤醒 APP Clips。是必须要上架商店之后才能支持么?
I have a view with some buttons, and add 2 gestures using simultaneously. My app works well when built with XCode less than 16, or run on iOS less than 18.0.
Example code is below:
VStack(spacing: 0) {
Button {
print("button tapped")
} label: {
Rectangle()
.foregroundColor(.red)
}
.frame(height: 100)
}
.gesture(
DragGesture(minimumDistance: 0)
.onEnded { value in
print("single tap")
}
.simultaneously(with:
TapGesture(count: 2).onEnded {
print("double tap")
}
)
)
.frame(width: 200, height: 200)
.border(Color.purple)
I expect the action on Button should be recognized and print out button tapped, but only single tap and double tap are recognized
Hello, I have encountered a question that I hope to receive an answer to. Currently, I am working on a music project for Mac Catalyst and need to enable music files such as FLAC to be opened by right clicking to view my Mac Catalyst app. But currently, I have encountered a problem where I can see my app option in the right-click open mode after debugging the newly created macOS project using the following configuration. But when I created an iOS project and converted it to a Mac Catalyst app, and then modified the info.plist with the same configuration, I couldn't see my app in the open mode after debugging. May I ask how to solve this problem? Do I need to configure any permissions or features in the Mac Catalyst project? I have been searching for a long time but have not found a solution regarding it. Please resolve it, thank you.
Here is the configuration of my macOS project:
CFBundleDocumentTypes
CFBundleTypeExtensions
flac
CFBundleTypeIconSystemGenerated
1
CFBundleTypeName
FLAC Audio File
CFBundleTypeRole
Viewer
LSHandlerRank
Default
Note: Sandbox permissions have been enabled for both the macOS project and the iOS to Mac Catalyst project. The Mac Catalyst project also has additional permissions for com. apple. security. files. user taught. read write
Hello, we have a requirement where clicking a button will highlight the model, similar to the effect seen by the eyes. However, the eyes do not see it and it is achieved by clicking a button. What should we do? Thank you for your reply
Where from and how does an NSRulerView get its magnification from? I am not using the automatic magnification by NSScrollView but using my own mechanism. How do I relay the zoom factor to NSRulerView?
I am trying to work with the data inside the barcode string in shared PKPass.
The documentation shows that is should look for @property (nonatomic, readonly, nullable) PKBarcode *primaryBarcode;
I have tried to use it like this
guard let code = pass.primaryBarcode?.message else { return }
I get a constant message that PKPass has no member primaryBarcode
The PKPass.h file in my IOS SDK does not seem to include the @property primaryBarcode or @property barcode.
I am running Xcode 16.4 (16F6) and my app target is 17.6 + Is there a restriction on this property?
I cannot find an SDK later than mine - the App Store does not offer one.
I am unsure of this is a public or private issue - does anyone know?
Thanks for reading this.
Max
Topic:
UI Frameworks
SubTopic:
SwiftUI
Hi,
A class initialized as the initial value of an @State property is not released until the whole View disappears. Every subsequent instance deinitializes properly.
Am I missing something, or is this a known issue?
struct ContentView: View {
// 1 - init first SimpleClass instance
@State var simpleClass: SimpleClass? = SimpleClass(name: "First")
var body: some View {
VStack {
Text("Hello, world!")
}
.task {
try? await Task.sleep(for: .seconds(2))
// 2 - init second SimpleClass instance and set as new @State
// "First" should deinit
simpleClass = SimpleClass(name: "Second")
// 3 - "Second" deinit just fine
simpleClass = nil
}
}
}
class SimpleClass {
let name: String
init(name: String) {
print("init: \(name)")
self.name = name
}
deinit {
print("deinit: \(name)")
}
}
output:
init: First
init: Second
deinit: Second
Thanks