I have an alertController that is presented as popover on iPad
let alertController = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: alertStyle)
if let ppc = alertController.popoverPresentationController {
// …
}
Is it possible to change the message font color (which is really very light on iPad) ?
It is OK on iPhone with the same alert (not popover): text is much more readable:
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I create a notification with an image attachment:
let center = UNUserNotificationCenter.current()
center.delegate = self
let content = UNMutableNotificationContent()
// some more stuff…
let paths = NSSearchPathForDirectoriesInDomains(
FileManager.SearchPathDirectory.documentDirectory,
FileManager.SearchPathDomainMask.userDomainMask, true)
let documentsDirectory = paths[0] as NSString
let fileExtPNG = "#" + "\(imageName)" + " photo.png"
let fileNamePNG = documentsDirectory.appendingPathComponent(fileExtPNG) as String
url = URL(fileURLWithPath: fileNamePNG)
let attachment = try UNNotificationAttachment(identifier: "Image", url: url, options: nil)
content.attachments = [attachment]
I then add the request:
let request = UNNotificationRequest(identifier:requestIdentifier, content: content, trigger: nil)
center.removePendingNotificationRequests(withIdentifiers: [requestIdentifier])
center.add(request) {(error) in }
Problem: when I later test (once notification has been registered), the file do not exist anymore at the url.
I've commented out the add request to confirm.
I have a work around, by creating a temporary copy of the file at the URL and pass it in the attachment.
Then, everything works fine and the copy is deleted.
But that's a bit bizarre. What am I missing here ?
When picking a photo in the gallery, whatever the orientation of the original image, size is always as landscape
if let image = info[convertFromUIImagePickerControllerInfoKey(UIImagePickerController.InfoKey.editedImage)] as? UIImage {
print("picked original", image.size)
For a portrait photo:
picked original (1122.0, 932.0)
For a landscape:
picked original (1124.0, 844.0)
What am I missing ?
In this setup, label do not show properly because of the textColor.
Labels are defined in IB, in the following hierarchy:
ViewController
View
Label 1
scrollView
View
Button
Label 2
Buttons show properly, but labels, even though defined with default label color appear as if their alpha was 0.2. It is even worse in dark mode:
I have checked the settings for the label and did not find anything anormal:
I have tried to change label color to system.gray 2, to no avail. If I change to red, does not show in red in IB.
Problem appears for both Label 1 (at the top level in the view) and Label 2
In this UIKit app, I have to display numbers (from 1 to 100), in a label., on several lines, with 8 numbers on each line. Order is computed by the app for a specific purpose.
The numbers are separated by space. Label font is Helvetica Neue 15.0.
I want to get them aligned vertically.
So, I have a padding so that they are all the same length of 4.
Problem: the space have smaller width (half in fact) than digits, so alignment is disrupted:
Of course, I can use fixed width fonts (like Menlo), but I've not found one that fits (the zero is barred, which is not looking great in the app).
I have tried using
class func monospacedDigitSystemFont(
ofSize fontSize: CGFloat,
weight: UIFont.Weight
) -> UIFont
and apply to label.text. To no avail as it modifies only digits, not space char.
I have found a workaround, padding with 2 spaces instead of one,
but is there another solution ?
So I am looking for a space character that would have the same width as a digit. There existe thin space (https://en.wikipedia.org/wiki/Whitespace_character) but not larger space.
Does it exist ?
Apparently, settings do not show anymore the apps settings in iOS 18.2.
I tested on simulators (Xcode 16.2) both on iOS 18.1 and iOS 18.2 and got very different results:
In iOS 18.1 simulator, I see the settings of a lot of apps.
In iOS 18.2 simulator, not a single app setting.
That is a really serious issue in simulator for development (I filed a bug report FB16175635), but would be really critical on device as it would make it impossible to adjust setting of many apps.
Unless I missed something (meta setting ?) in iOS 18.2 ?
I have not upgraded to 18.2 notably for this reason. So I would appreciate if someone who has upgraded could make the test and report ?
select Settings on Home page
scroll to Apps category
tap here to access the list
Does the list show anything ?
Thanks for your help.
Since recently (maybe after updating to Sonoma 14.7.1 - 23H222, but not sure, I get a crash report stating that SafariBookmarksSyncAgent quitted unexpectedly Once acquitted the report, it will reappear 2 minutes later as long as Xcode is open.
Configuration:
Sonoma 14.7.1
Safari Technology Preview Release 208 (Safari 18.2, WebKit 19621.1.5.1)
Xcode 15.3 (15E204a)
That seems to be a known problem.
Question: Is it due to MacOS version ? To Xcode version ? To Safari version ? To webKit version ? Or to simulator, as I gat an AegirPoster crash (as described here: https://stackoverflow.com/questions/77083912/macbook-pro-crashes-when-using-simulator-aegirposter-process)
I read that I would need to restart some devices (eg, iPhone). That seems to temporarily solve the problem
Here is a part of the report:
Incident Identifier: 0D2456DF-5801-41D6-8294-2BF442224913
CrashReporter Key: 4DE33529-174E-32C5-D8A8-26FE128BE16B
Hardware Model: Mac14,12
Process: SafariBookmarksSyncAgent [38972]
Path: /Volumes/VOLUME/*/SafariSupport.bundle/SafariBookmarksSyncAgent
Identifier: com.apple.SafariBookmarksSyncAgent
Version: 8614 (8614.1.25.0.17)
Code Type: ARM-64 (Native)
Role: Unspecified
Parent Process: launchd_sim [28070]
Coalition: com.apple.CoreSimulator.SimDevice.0058D576-D9FF-4169-8437-D0A24C923500 [9832]
Responsible Process: SimulatorTrampoline [1116]
Date/Time: 2024-11-27 15:19:42.4908 +0100
Launch Time: 2024-11-27 15:19:42.4610 +0100
OS Version: macOS 14.7.1 (23H222)
Release Type: User
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000204476580
Exception Codes: 0x0000000000000001, 0x0000000204476580
VM Region Info: 0x204476580 is not in any region. Bytes after previous region: 894002561 Bytes before following region: 58984012416
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
VM_ALLOCATE 1cefdc000-1cefe0000 [ 16K] r--/rwx SM=PRV
---> GAP OF 0xdf1020000 BYTES
commpage (reserved) fc0000000-1000000000 [ 1.0G] ---/--- SM=COW reserved VM address space (unallocated)
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [38972]
Triggered by Thread: 0
Thread 0 Crashed:
0 dyld_sim 0x104f9dc7c dyld4::SyscallDelegate::forEachInDirectory(char const*, bool, void (char const*, char const*) block_pointer) const + 172
1 dyld_sim 0x104f88b6c invocation function for block in dyld4::ProcessConfig::PathOverrides::processVersionedPaths(dyld4::ProcessConfig::Process const&, dyld4::SyscallDelegate&, dyld4::ProcessConfig::DyldCache const&, dyld3::Platform, dyld3::GradedArchs const&, lsl::Allocator&) + 104
2 dyld_sim 0x104f88aa0 dyld4::ProcessConfig::PathOverrides::forEachInColonList(char const*, char const*, bool&, void (char const*, bool&) block_pointer) + 224
3 dyld_sim 0x104f886b8 dyld4::ProcessConfig::PathOverrides::processVersionedPaths(dyld4::ProcessConfig::Process const&, dyld4::SyscallDelegate&, dyld4::ProcessConfig::DyldCache const&, dyld3::Platform, dyld3::GradedArchs const&, lsl::Allocator&) + 144
4 dyld_sim 0x104f882a8 dyld4::ProcessConfig::PathOverrides::PathOverrides(dyld4::ProcessConfig::Process const&, dyld4::ProcessConfig::Security const&, dyld4::ProcessConfig::Logging const&, dyld4::ProcessConfig::DyldCache const&, dyld4::SyscallDelegate&, lsl::Allocator&) + 344
5 dyld_sim 0x104f868b8 dyld4::ProcessConfig::ProcessConfig(dyld4::KernelArgs const*, dyld4::SyscallDelegate&, lsl::Allocator&) + 152
6 dyld_sim 0x104f85e30 _dyld_sim_prepare + 352
7 dyld 0x10492fa8c dyld4::prepareSim(dyld4::RuntimeState&, char const*) + 1276
8 dyld 0x10492e4f0 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 308
9 dyld 0x10492def4 start + 1868
I filed a bug report: Nov 27, 2024 at 3:41 PM – FB15976427
To change the background of a TextField, I simply apply:
TextField("0.0", value: $p, format: .number)
.textFieldStyle(PlainTextFieldStyle())
.background(.red)
That does only work with plain style, but it works.
Trying something similar on a button changes the container view background.
The only solution I've found is to overlap with a Rectangle.
How is it ?
A SwiftUI bug ?
A current limit of Swift ?
A rationale for it ?
There a better solution I've not found ?
In this app, I set the preferredColorScheme in main
@main
struct TheApp: App {
@AppStorage("isDarkMode") private var isDarkMode = false
var body: some Scene {
WindowGroup {
ContentView()
.preferredColorScheme(isDarkMode ? .dark : .light)
}
}
}
isDarkMode is changed dynamically in code.
When code is compiled with Xcode 15.3, the background of ContentView changes from light to dark or vice versa.
When compiled with Xcode 16, no more change.
However, direct changes to objects do work, such as:
TextField("N", value: $t, format: .number)
.frame(width: 40)
.background(isDarkMode ? .gray : .white)
What has changed in Xcode 16 ? Is it documented somewhere ?
I saw this SO thread which describe similar problem.
https://www.reddit.com/r/swift/comments/upkprg/preferredcolorscheme_toggle_not_working/
This app may run on MacOS or iOS.
I want to use windowResizability modifier (specially In MacOS) which is only available on masOS 13+ and iOS 17+, but still need to run on macOS 12 or iOS 15…
So I need something like
#if os(macOS)
if #available(macOS 13 *) {
use windowResizability
#else
do not use windowResizability
#endif
#else // iOS
if #available(iOS 17 *) {
use windowResizability
#else
do not use windowResizability
#endif
Here is the code where to apply (in @main)
struct TheApp: App {
var body: some Scene {
WindowGroup {
ContentView() // 1.11.2023
.frame(
minWidth: 1200, maxWidth: .infinity,
minHeight: 600, maxHeight: .infinity)
}
.windowResizability(.contentSize) // BTW: is that really necessary ?
}
}
How can I achieve this ? Do I need to write a WindowGroup extension for the modifier ? If so, how ?
BTW: is windowResizability really necessary ? App seems to work the same without it.
I create a UIKit PullDown menu (in a positionMenu button), with the following code:
func setupPullDownMenu() {
let menu1 = UIAction(title: "Menu1") { [self] _ in
// some code
}
let menu2 = UIAction(title: "Menu2") { [self] _ in
// some code
}
let menu3 = UIAction(title: "Menu3") { [self] _ in
// some code
}
let menu = UIMenu(title: "Positions", children: [menu1, menu2, menu3])
positionMenu.menu = menu
positionMenu.showsMenuAsPrimaryAction = true
}
In Portrait, options are listed as Menu1, Menu2, Menu3
But in Landscape it is the reverse: Menu3, Menu2, Menu1
I use Xcode 16.1ß and iOS 17.0 simulator
Is it the expected behaviour ?
Is it only me ?
I received recently a notification that an answer was "recommended by Apple", with a link to the post.
But when going to the post, this recommendation (with small Apple icon) do not show.
And the forum scores are not updated.
This is not the first time I get problems with forum notifications.
I filed a bug report: FB14172207
I see this message for the first time:
It is inserted in the OP (https://developer.apple.com/forums/thread/757852) but the link leads to nowhere (just the general page of the forum).
In … what ?!?
So I wonder what is the meaning of the message, its intent and use ? Or is it just a forum bug ?
PS: surprisingly, this post appears in Forums general page (https://developer.apple.com/forums/latest), but not in forums feedback (https://developer.apple.com/forums/tags/forums-feedback)
PS2: it appears, but after all the pinned messages which are older. Really confusing…
I posted a bug report on this: Jun 23, 2024 at 9:29 PM – FB14024970
Since 2 hours (1:20 GMT July 18), I keep receiving the exact same message from iTunesStore every 5 minutes (30 received so far, with metronome regularity):
Your banking information was accepted
Thank you for providing the requested details for xxxxxx associated with your banking update in App Store Connect.
Any payments may take up to 2 payment cycles to send. If you have any questions, contact us at http://developer.apple.com/contact/.
I did not update any information since at least 6 weeks.
I contacted support, it seems to be widespread problem.
I filed a bug report: Jul 18, 2024 at 5:51 PM – FB14377820
I've recently seen answers to posts that are apparently automatically generated but signed as App Store Connect Engineer. In several cases the answer is misinterpreting the OP.
Here is an example: https://developer.apple.com/forums/thread/758391
The OP was really a developer question. Not related to a consumer feature.
Is it really an automatic answer (which would be a bad trend for the forums IMHO)?