Post

Replies

Boosts

Views

Activity

URL passed as attachment to notification is deleted when notification is added
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 ?
2
0
180
1w
Picked photo in the gallery does not recognise image orientation
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 ?
1
0
158
1w
Set UILabel color in alertController
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:
1
0
175
2w
labels appear as dimmed in UIView
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
1
0
188
3w
Immediate crash of Apple Watch simulator when typing a key
I get a crash in Apple Watch simulator (Series 9 45mm 18.0) as soon as the app launch if I type anything on external keyboard (just hitting command key for instance to capture a screenshot). Same crash on series 7 (45mm, OS 18.1) But app works normally when I use mouse to interact with the app on simulator. App does not crash on real device (Watch 4 OS 10.4.1). Nor does it crash on Series 6 simulator (44 mm OS 17.4). Here are the log I could collect (apparently, they contain sensitive language !!! so I attach as a file.: Attached logs
1
0
171
3w
No new Xcode beta Since 16.2 Release on Dec 11
Not a question, but a surprise. Did I miss something, but apparently there has been no new beta release (16.3) since Release of 16.2 on Dec 11. 2 months without betas is really unusual (in fact, it never happened and usually, next beta n+1 is even released before the final release of version n). So does that mean 16.3 will be a major update ? Wait and see.
4
4
379
3w
Could someone test if Settings in iOS 18.2 are broken ?
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.
1
1
739
Dec ’24
Typographic question for space character
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 ?
5
0
469
Nov ’24
SafariBookmarksSyncAgent quits unexpectedly
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
1
0
376
Nov ’24
Is a spam an appreciated participation in the forums ?
There are at the moment a lot of spams for a bank phone number. https://developer.apple.com/forums/thread/769506 What is really surprising is to read App Store Connect Engineer answer, each time the same: We appreciate your interest in participating in the forums! These forums are for questions about developing software and accessories for Apple platforms. Your question seems related to a consumer feature and is better suited for the Apple Support Communities Is it an automatic answer (I cannot believe anyone who read the post did not notice it was a spam) ? If so, couldn't it simply detect it is a spam (Apple Intelligence could come to help) and delete the message (or the account) ? PS: it would also be a spam in Apple Support Communities PS2: I note the message has been deleted very rapidly.
7
1
581
Nov ’24
Developing a driver to read HFS disks on MacOS Sonoma and newer
Capability to read and write ofd HFS disks on Mac has been removed since a long time. Capability to simply read was also removed since Catalina I think. That is surprising and sometimes frustrating. I still use a 90's MacBook for a few tasks and need from time to time to transfer files to newer Mac or read some old files stored on 3.5" disks. Solution I use is to read the disk on an old Mac with MacOS 10.6 (I'm lucky enough to have kept one) and transfer to USB stick or airdrop… As there is no USB port on the Macbook of course (and I have no more a working 56k modem to transfer by mail), only option if not 3,5" disk is using PCMCIA port on the MacBook for writing to an SD Card to be read in Mac Sonoma. But reading directly 3.5" disk would be great. Hence my questions for the forum: how hard would it be to write such a driver for READING only HFS on Mac Sonoma? There are some software like FuseHFS. Did anyone experience it ? Did anyone have a look at the source code (said to be open source). does anyone know why Apple removed such capability (I thought it was a tiny piece of code compared to the GB of present MacOS)? Thanks for any insights on the matter.
2
0
454
Nov ’24
Changing background colour of Button changes the container background
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 ?
3
0
371
Oct ’24
preferredColorScheme not working with Xcode 16
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/
10
0
796
Oct ’24
SwiftUI conditional modifier depending on OS type and version
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.
1
1
527
Oct ’24
PullDown menu shows in reverse order when in landscape
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 ?
1
0
643
Aug ’24