Foundation

RSS for tag

Access essential data types, collections, and operating-system services to define the base layer of functionality for your app using Foundation.

Posts under Foundation tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

NSDirectoryEnumerator returns nil
I'm trying to display my images in a tableView, I'm using NSFIleManager and NSDirectoryEnumerator to get all files in the current folder: NSString *path = @"/Users/eagle/Documents/avatars"; NSFileManager *fileManager = NSFileManager.defaultManager; NSDirectoryEnumerator *directoryEnum = [fileManager enumeratorAtPath:path]; NSString *file; while (file = [directoryEnum nextObject]) { // ... } the problem is that this line file = [directoryEnum nextObject] always returns nil, what gives? I already made sure that this folder has no subfolders and contains only images, so what's the problem here?
4
0
275
Oct ’24
Crash with Progress type, Swift 6, iOS 18
We are getting a crash _dispatch_assert_queue_fail when the cancellationHandler on NSProgress is called. We do not see this with iOS 17.x, only on iOS 18. We are building in Swift 6 language mode and do not have any compiler warnings. We have a type whose init looks something like this: init( request: URLRequest, destinationURL: URL, session: URLSession ) { progress = Progress() progress.kind = .file progress.fileOperationKind = .downloading progress.fileURL = destinationURL progress.pausingHandler = { [weak self] in self?.setIsPaused(true) } progress.resumingHandler = { [weak self] in self?.setIsPaused(false) } progress.cancellationHandler = { [weak self] in self?.cancel() } When the progress is cancelled, and the cancellation handler is invoked. We get the crash. The crash is not reproducible 100% of the time, but it happens significantly often. Especially after cleaning and rebuilding and running our tests. * thread #4, queue = 'com.apple.root.default-qos', stop reason = EXC_BREAKPOINT (code=1, subcode=0x18017b0e8) * frame #0: 0x000000018017b0e8 libdispatch.dylib`_dispatch_assert_queue_fail + 116 frame #1: 0x000000018017b074 libdispatch.dylib`dispatch_assert_queue + 188 frame #2: 0x00000002444c63e0 libswift_Concurrency.dylib`swift_task_isCurrentExecutorImpl(swift::SerialExecutorRef) + 284 frame #3: 0x000000010b80bd84 MyTests`closure #3 in MyController.init() at MyController.swift:0 frame #4: 0x000000010b80bb04 MyTests`thunk for @escaping @callee_guaranteed @Sendable () -> () at <compiler-generated>:0 frame #5: 0x00000001810276b0 Foundation`__20-[NSProgress cancel]_block_invoke_3 + 28 frame #6: 0x00000001801774ec libdispatch.dylib`_dispatch_call_block_and_release + 24 frame #7: 0x0000000180178de0 libdispatch.dylib`_dispatch_client_callout + 16 frame #8: 0x000000018018b7dc libdispatch.dylib`_dispatch_root_queue_drain + 1072 frame #9: 0x000000018018bf60 libdispatch.dylib`_dispatch_worker_thread2 + 232 frame #10: 0x00000001012a77d8 libsystem_pthread.dylib`_pthread_wqthread + 224 Any thoughts on why this is crashing and what we can do to work-around it? I have not been able to extract our code into a simple reproducible case yet. And I mostly see it when running our code in a testing environment (XCTest). Although I have been able to reproduce it running an app a few times, it's just less common.
23
7
933
Oct ’24
Interpreting received "Data" object in cpp
Hello Everyone, I have a use case where I wanted to interpret the "Data" object received as a part of my NWConnection's recv call. I have my interpretation logic in cpp so in swift I extract the pointer to the raw bytes from Data and pass it to cpp as a UnsafeMutableRawPointer. In cpp it is received as a void * where I typecast it to char * to read data byte by byte before framing a response. I am able to get the pointer of the bytes by using // Swift Code // pContent is the received Data if let content = pContent, !content.isEmpty { bytes = content.withUnsafeBytes { rawBufferPointer in guard let buffer = rawBufferPointer.baseAddress else { // return with null data. } // invoke cpp method to interpret data and trigger response. } // Cpp Code void InterpretResponse (void * pDataPointer, int pDataLength) { char * data = (char *) pDataPointer; for (int iterator = 0; iterator < pDataLength; ++iterator ) { std::cout << data<< std::endl; data++; } } When I pass this buffer to cpp, I am unable to interpret it properly. Can someone help me out here? Thanks :) Harshal
3
0
566
Oct ’24
NSAttributedString.enumerateAttribute(_:in) crashes with custom attribute in macOS Sequoia
The following code crashes on macOS 15 Sequoia: import Foundation let key = NSAttributedString.Key("org.example.key") let value = Value() let string = NSMutableAttributedString() string.append(NSAttributedString(string: "a", attributes: [:])) string.append(NSAttributedString(string: "b", attributes: [key: value])) string.append(NSAttributedString(string: "c", attributes: [:])) string.enumerateAttribute(key, in: NSRange(location: 0, length: string.length)) { value, range, stop in print(range) } class Value: Equatable, Hashable { static func == (lhs: Value, rhs: Value) -> Bool { return lhs === rhs } func hash(into hasher: inout Hasher) { hasher.combine(ObjectIdentifier(self)) } } The error is EXC_BAD_ACCESS (code=1, address=0x0) I wanted to run it on my external macOS 14 partition to confirm that it didn't crash before updating to macOS 15, but for some reason macOS will just restart and boot again into macOS 15. So I tried with macOS 13, which I was allowed to start for some reason, and I was able to confirm that the code doesn't crash. Is this a known issue, and is there a workaround? Removing the two lines that add the letters a and c, or just declaring class Value without conformance to Equatable, Hashable, interestingly, solves the issue.
5
0
308
Oct ’24
UserDefaults.didChangeNotification not firing
Hi, I'm currently working on an app made originally for iOS 15. On it, I add an observer on viewDidLoad function of my ViewController to listen for changes on the UserDefault values for connection settings. NotificationCenter.default.addObserver(self, selector: #selector(settingsChanged), name: UserDefaults.didChangeNotification, object: nil) Said values can only be modified on the app's section from System Settings. Thing is, up to iOS 17, the notification fired as expected, but starting from iOS 18, the notification doesn't seem to be sent by the OS. Is there anything I should change in my observer, or any other technique to listen for the describe event? Thanks in advance.
4
1
326
1w
How does font caching / resources for each app work?
I'm a font developer. In the development process, I will revise a font and overwrite the OTF file that is currently enabled (registered) with macOS. If I then launch an app, it will immediately use the revised version of the font; while apps that are already loaded will continue to use the old version. This suggests that each app is loading new and separate font data, rather than getting it from some existing cache in memory. Yet macOS does have a "font cache" of some sort. Some apps, like TextEdit, seem to only load the fonts that they need to use. However, other apps, like Pages, load every enabled (registered) font on the OS!! (According to the Open Files list in Activity Monitor.) Given that /System/Library/Fonts/ is 625 Mb, and we can't disable any of it, isn't that a lot of data to be repeating? How many fonts is too many fonts? I can't find much documentation about the process.
0
0
219
Sep ’24
NSDecimalNumber crash on iOS18 when using decimalNumberByDividingBy
NSDecimalNumber will crash on iOS18 when using decimalNumberByDividingBy in some cases. For example NSDecimalNumber* a= [NSDecimalNumber decimalNumberWithString:@"21000000000"]; NSDecimalNumber* b= [NSDecimalNumber decimalNumberWithString:@"18446744073709551615"]; NSDecimalNumber* c = [a decimalNumberByDividingBy:b]; // this line will crash the crash error is EXC_BREAKPOINT the crash stack is I know some foundation implementation changed on iOS18, But are there some ways to avoid it? It appears on iOS18 only.
1
0
290
Sep ’24
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
457
Sep ’24
Has iOS 18 changed the threshold for decoding base64 into ASCII code?
This code fails to decode when running on iOS 18.0 or 18.1 beta device. But succeeds below iOS 18, such as iOS 17.5. Xcode Version 16.0 (16A242d) let base64String = "1ZwoNohdE8Nteis/IXl1rg==" if let decodedData = Data(base64Encoded: base64String, options: .ignoreUnknownCharacters) { if let decodedString = String(data: decodedData, encoding: .ascii) { print("Decoded string: \(decodedString)") } else { print("Failed to decode string using ascii encoding") } } else { print("Failed to decode Base64 string") }
7
0
622
Oct ’24
App crash after update to IOS 18
After update to IOS18, my app crashed. following is the exception got from xcode: Trapped uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSFileManager createDirectoryAtURL:withIntermediateDirectories:attributes:error:]: URL is nil' ( 0 CoreFoundation 0x0000000194a79098 47427277-EE15-3C17-AD68-6886B0380B5E + 540824 1 libobjc.A.dylib 0x0000000191d7b2e4 objc_exception_throw + 88 2 Foundation 0x0000000193741f48 12E17A7A-B65F-35EE-82D7-CBC31004E223 + 1154888 3 CFNetwork 0x0000000195eeb2bc FA95B718-E8EB-34BD-90FA-8FB1AFE016D6 + 164540 4 CFNetwork 0x0000000195eeac7c FA95B718-E8EB-34BD-90FA-8FB1AFE016D6 + 162940 5 libdispatch.dylib 0x000000010342a71c _dispatch_client_callout + 20 6 libdispatch.dylib 0x000000010343bf04 _dispatch_lane_barrier_sync_invoke_and_complete + 176 7 CFNetwork 0x0000000195eeaa88 FA95B718-E8EB-34BD-90FA-8FB1AFE016D6 + 162440 8 CFNetwork 0x0000000195ee9b20 FA95B718-E8EB-34BD-90FA-8FB1AFE016D6 + 158496 9 CFNetwork 0x0000000195ee95f4 FA95B718-E8EB-34BD-90FA-8FB1AFE016D6 + 157172 10 CFNetwork 0x0000000195ee907c FA95B718-E8EB-34BD-90FA-8FB1AFE016D6 + 155772 11 CFNetwork 0x0000000195ee34b0 FA95B718-E8EB-34BD-90FA-8FB1AFE016D6 + 132272 12 CFNetwork 0x0000000195f942c4 FA95B718-E8EB-34BD-90FA-8FB1AFE016D6 + 856772 13 CFNetwork 0x0000000195f94214 FA95B718-E8EB-34BD-90FA-8FB1AFE016D6 + 856596 14 CFNetwork 0x0000000195f9330c FA95B718-E8EB-34BD-90FA-8FB1AFE016D6 + 852748 15 libdispatch.dylib 0x0000000103428a30 _dispatch_call_block_and_release + 32 16 libdispatch.dylib 0x000000010342a71c _dispatch_client_callout + 20 17 libdispatch.dylib 0x00000001034325e8 _dispatch_lane_serial_drain + 828 18 libdispatch.dylib 0x0000000103433394 _dispatch_lane_invoke + 460 19 libdispatch.dylib 0x0000000103434b20 _dispatch_workloop_invoke + 2264 20 libdispatch.dylib 0x00000001034405f0 _dispatch_root_queue_drain_deferred_wlh + 328 21 libdispatch.dylib 0x000000010343fc00 _dispatch_workloop_worker_thread + 580 22 libsystem_pthread.dylib 0x000000021bddfc7c _pthread_wqthread + 288 23 libsystem_pthread.dylib 0x000000021bddc488 start_wqthread + 8 ) This app works fine until ios 18 appear. Could you help me? thanks
7
0
1.9k
Sep ’24
[iOS18] Crash in `static NSDecimal./ infix(_:_:)`
Crashed: com.apple.main-thread 0 Foundation 0x2bd25c specialized static NSDecimal._integerDivide(dividend:divisor:maxResultLength:) + 1996 1 Foundation 0x2c1c0c specialized NSDecimal._divide(by:roundingMode:) + 2432 2 Foundation 0x372710 static NSDecimal./ infix(_:_:) + 64 Crashed: com.um.positions.fiber.queue 0 Foundation 0x2bdc94 <redacted> + 1996 1 Foundation 0x2c2644 <redacted> + 2432 2 Foundation 0x372804 $sSo9NSDecimala10FoundationE1doiyA2B_ABtFZ + 64 After iOS18, some new crashes appeared, but they never appeared before iOS18. How to avoid such crashes? I checked the API documentation and there is no relevant modification, https://developer.apple.com/documentation/foundation/1409398-nsdecimaldivide However, I parsed iOS_22A5326g/../Foundation.framework/Foundation, and found that this EXC_BREAKPOINT is newly added You can reproduce it with the following code: let a: Decimal = .greatestFiniteMagnitude let b: Decimal = .greatestFiniteMagnitude let c = a / b // if < iOS18, c = 1. if = iOS18, will crashed ;< print(c)
3
1
549
Sep ’24
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
259
Sep ’24
Crash on launch from all TestFlight builds, but when loading the app from Xcode
We are preparing a launch for iOS 18, and we experienced crashes from iOS 17 devices. If I load the app right from Xcode 16 RC to the iOS 17 device, then it works fine, but if I download it from TestFlight, the nit crashes. The app crashes immediately upon launch due to a missing symbol in the Foundation framework. I'm hoping someone can provide insights or suggestions on how to resolve this. Error Message CopySymbol not found: _$s10Foundation14NSDecimalRoundyySpySo0B0aG_SPyADGSiSo14NSRoundingModeVtF Referenced from: <C1ABDA48-29EE-3674-8554-669220A76F81> /Volumes/VOLUME/*/CamPlan.app/CamPlan Expected in: <D92E19C1-6299-3E94-8614-C505D5ABCCDB> /System/Library/Frameworks/Foundation.framework/Foundation What I've Tried Verified that the app is compiled with the latest Xcode version Checked for any usage of private APIs (none found) Reviewed usage of Foundation framework methods, especially those related to NSDecimalRound Questions What could be causing this symbol to be missing? Are there any known issues with NSDecimalRound or related functions in recent iOS versions? How can I identify which part of my code is trying to use this missing symbol?
6
1
850
Sep ’24
Infer error domain and code from localizedDescription
I have been bitten by this repeatedly so I am finally going to ask: Is there a way to infer an error from its localizedDescription only? It sometimes happens that a user reaches out for support with just a localized error message, but no error code or error domain and it is really hard to correctly guess what the non-localized description may have been in order to search for it. For example I know from experience that "Der eingegebene Benutzername oder das Passwort ist ungültig." is the German localization of "The user name or passphrase you entered is not correct." which in turn is errSecAuthFailed (aka. -25293). It would be really helpful to be able to just look this up somewhere...
2
0
338
Sep ’24
Range of Network / Multipeer
Since Apple Multipeer framework does not really work without crashes, I implemented my own multipeer with the Network.framework. like let tcpOptions = NWProtocolTCP.Options.createDefault() let parameters = NWParameters(tls: NWProtocolTLS.Options(), tcp: tcpOptions) parameters.setDefaultSettings() let browser = NWBrowser( for: .bonjour( type: config.bonjourServiceType, domain: nil ), using: parameters ) and extension NWParameters { func setDefaultSettings() { self.includePeerToPeer = true self.requiredInterfaceType = .wifi self.preferNoProxies = true } } extension NWProtocolTCP.Options { static func createDefault() -> NWProtocolTCP.Options { let tcpOptions = NWProtocolTCP.Options() tcpOptions.enableKeepalive = true tcpOptions.keepaliveIdle = 10 // 10 seconds keepalive interval tcpOptions.noDelay = true // Disable Nagle's algorithm for low latency return tcpOptions } } it works well up to approx. 30 meter outside with free view. What's the max range for the peer to peer via bonjour? And is there a way to get longer distance than 30 meter?
1
0
362
Sep ’24
EXC_BAD_ACCESS (SIGSEGV) crash observed in NSDateFormatter APIs
Hi Team, I am using NSDateFormatter to print date and time in my logger class. // Get current date and time NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; dateFormatter.dateFormat = @"yyyy-MM-dd HH:mm:ss"; NSString *dateTimeString = [dateFormatter stringFromDate:[NSDate date]]; I am using the NSDateFormatter as shown in the above snippet, but I am seeing random crashes with the below stack trace. This crash is random and can't be reproduced consistently. 0 libobjc.A.dylib 0x7ff8051a021d objc_msgSend + 29 1 CoreFoundation 0x7ff8056609ef __CFDateFormatterSetSymbolsArray + 59 2 CoreFoundation 0x7ff80564db87 __ApplyUDateFormatSymbol + 324 3 CoreFoundation 0x7ff80564c854 __ResetUDateFormat + 3064 4 CoreFoundation 0x7ff80564bc30 __CreateCFDateFormatter + 320 5 Foundation 0x7ff8064c2ae3 -[NSDateFormatter _regenerateFormatter] + 323 6 Foundation 0x7ff8064c2858 -[NSDateFormatter stringForObjectValue:] + 297 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000018 Exception Codes: 0x0000000000000001, 0x0000000000000018 Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11 Terminating Process: exc handler [5372] Can someone please suggest if there is something wrong in the way NSDateFormatter being used? I checked the documentation and found nothing that can be causing this issue. Thanks and Regards
2
0
281
Sep ’24
Crash on iOS: UIKitCore -[UIApplication _run] with CFRunLoopRun
Hello everyone, I’m experiencing a crash in my iOS application that’s occurring predominantly on devices running iOS 16.6.0. The crash seems to happen on the main thread during a UI operation, specifically within the UIKitCore framework. Crash Log Summary Thread 0 Crashed: 0 libsystem_kernel.dylib 0xca4 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x13b74 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x13e4c mach_msg_overwrite + 540 3 libsystem_kernel.dylib 0x11e8 mach_msg + 24 4 CoreFoundation 0x79024 __CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x7a250 __CFRunLoopRun + 1208 6 CoreFoundation 0x7f3ec CFRunLoopRunSpecific + 612 7 GraphicsServices 0x135c GSEventRunModal + 164 8 UIKitCore 0x39cf58 -[UIApplication _run] + 888 9 UIKitCore 0x39cbbc UIApplicationMain + 340 10 MyApp 0x24050 main + 51 (AppDelegate.swift:51) 11 ??? 0x1d3594dec (Missing) I’ve attached the full crash crashlog.txt and would appreciate any insights or recommendations on how to resolve this issue.
1
0
503
Aug ’24
CF_IS_OBJC crash
Hi all. I've read all the posts related to CF_IS_OBJC, including this one, but since I don't have an Objective-C background and mostly work with Swift and SwiftUI, I'm struggling to fully understand the recommendations or how to address this issue. Could someone explain it to me in simple terms (like I'm 5) and provide a step-by-step guide on what to do? This crash has affected 66 devices over the past month. Crashed: com.apple.main-thread 0 CoreFoundation 0xf878 CF_IS_OBJC + 24 1 CoreFoundation 0x17f58 CFArrayGetCount + 32 2 CoreGraphics 0x322a1c CGPDFTaggedNodeEnumerateChildren + 60 3 CoreGraphics 0x322880 CGPDFTaggedNodeGetBounds + 244 4 PDFKit 0x5524 -[UICGPDFNodeAccessibilityElement isAccessibilityElement] 5 UIAccessibility 0x48518 ___axuiElementForNotificationData_block_invoke + 28 6 UIAccessibility 0x35678 __94-[NSObject(AXPrivCategory) _accessibilityFindFirstAXDescendantPassingTest:byYieldingElements:]_block_invoke_2 + 36 7 UIAccessibility 0x3534c __96-[NSObject(AXPrivCategory) _accessibilityEnumerateAXDescendants:passingTest:byYieldingElements:]_block_invoke + 60 8 UIAccessibility 0x359d0 __57-[NSObject(AXPrivCategory) _accessibilityFindDescendant:]_block_invoke_2 + 60 9 UIAccessibility 0x1ec98 -[NSObject(AXPrivCategory) accessibilityEnumerateContainerElementsWithOptions:usingBlock:] + 548 10 UIAccessibility 0x35858 __57-[NSObject(AXPrivCategory) _accessibilityFindDescendant:]_block_invoke + 176 11 UIAccessibility 0x3539c __96-[NSObject(AXPrivCategory) _accessibilityEnumerateAXDescendants:passingTest:byYieldingElements:]_block_invoke + 140 12 UIAccessibility 0x359d0 __57-[NSObject(AXPrivCategory) _accessibilityFindDescendant:]_block_invoke_2 + 60 13 UIAccessibility 0x1ec98 -[NSObject(AXPrivCategory) accessibilityEnumerateContainerElementsWithOptions:usingBlock:] + 548 14 UIAccessibility 0x35858 __57-[NSObject(AXPrivCategory) _accessibilityFindDescendant:]_block_invoke + 176 15 UIAccessibility 0x3539c __96-[NSObject(AXPrivCategory) _accessibilityEnumerateAXDescendants:passingTest:byYieldingElements:]_block_invoke + 140 16 UIAccessibility 0x359d0 __57-[NSObject(AXPrivCategory) _accessibilityFindDescendant:]_block_invoke_2 + 60 17 UIAccessibility 0x1ec98 -[NSObject(AXPrivCategory) accessibilityEnumerateContainerElementsWithOptions:usingBlock:] + 548 18 UIAccessibility 0x35858 __57-[NSObject(AXPrivCategory) _accessibilityFindDescendant:]_block_invoke + 176 19 UIAccessibility 0x3539c __96-[NSObject(AXPrivCategory) _accessibilityEnumerateAXDescendants:passingTest:byYieldingElements:]_block_invoke + 140 20 UIAccessibility 0x359d0 __57-[NSObject(AXPrivCategory) _accessibilityFindDescendant:]_block_invoke_2 + 60 21 UIAccessibility 0x1ec98 -[NSObject(AXPrivCategory) accessibilityEnumerateContainerElementsWithOptions:usingBlock:] + 548 22 UIAccessibility 0x35858 __57-[NSObject(AXPrivCategory) _accessibilityFindDescendant:]_block_invoke + 176 23 UIAccessibility 0x3539c __96-[NSObject(AXPrivCategory) _accessibilityEnumerateAXDescendants:passingTest:byYieldingElements:]_block_invoke + 140 24 UIAccessibility 0x35918 __57-[NSObject(AXPrivCategory) _accessibilityFindDescendant:]_block_invoke + 368 25 UIAccessibility 0x3539c __96-[NSObject(AXPrivCategory) _accessibilityEnumerateAXDescendants:passingTest:byYieldingElements:]_block_invoke + 140 26 UIAccessibility 0x35294 -[NSObject _accessibilityEnumerateAXDescendants:passingTest:byYieldingElements:] + 244 27 UIAccessibility 0x355d0 -[NSObject _accessibilityFindFirstAXDescendantPassingTest:byYieldingElements:] + 272 28 UIAccessibility 0x35788 -[NSObject(AXPrivCategory) _accessibilityFindDescendant:] + 100 29 UIAccessibility 0x48280 _axuiElementForNotificationData + 276 30 UIAccessibility 0x347c _massageAssociatedElementBeforePost + 36 31 UIAccessibility 0x2648 _UIAXBroadcastMainThread + 292 32 libdispatch.dylib 0x213c _dispatch_call_block_and_release + 32 33 libdispatch.dylib 0x3dd4 _dispatch_client_callout + 20 34 libdispatch.dylib 0x125a4 _dispatch_main_queue_drain + 988 35 libdispatch.dylib 0x121b8 _dispatch_main_queue_callback_4CF + 44 36 CoreFoundation 0x56710 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 37 CoreFoundation 0x53914 __CFRunLoopRun + 1996 38 CoreFoundation 0x52cd8 CFRunLoopRunSpecific + 608 39 GraphicsServices 0x11a8 GSEventRunModal + 164 40 UIKitCore 0x40a90c -[UIApplication _run] + 888 41 UIKitCore 0x4be9d0 UIApplicationMain + 340 42 UIKitCore 0x638384 keypath_get_selector_hoverStyle + 11024 43 Wisconsin State Journal 0x3b4ae8 main + 4299246312 (AppDelegate.swift:4299246312) 44 ??? 0x1b7239e4c (Missing) com.apple.uikit.eventfetch-thread 0 libsystem_kernel.dylib 0x1808 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x5008 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x4f20 mach_msg_overwrite + 436 3 libsystem_kernel.dylib 0x4d60 mach_msg + 24 4 CoreFoundation 0x53f5c __CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x53600 __CFRunLoopRun + 1208 6 CoreFoundation 0x52cd8 CFRunLoopRunSpecific + 608 7 Foundation 0xc7e4c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 8 Foundation 0xc7c9c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 9 UIKitCore 0x41e640 -[UIEventFetcher threadMain] + 420 10 Foundation 0xde718 __NSThread__start__ + 732 11 libsystem_pthread.dylib 0x606c _pthread_start + 136 12 libsystem_pthread.dylib 0x10d8 thread_start + 8 com.google.firebase.crashlytics.MachExceptionServer 0 Wisconsin State Journal 0x83b668 FIRCLSProcessRecordAllThreads + 392 (FIRCLSProcess.c:392) 1 Wisconsin State Journal 0x83ba48 FIRCLSProcessRecordAllThreads + 423 (FIRCLSProcess.c:423) 2 Wisconsin State Journal 0x849c5c FIRCLSHandler + 34 (FIRCLSHandler.m:34) 3 Wisconsin State Journal 0x84a460 FIRCLSMachExceptionServer + 521 (FIRCLSMachException.c:521) 4 libsystem_pthread.dylib 0x606c _pthread_start + 136 5 libsystem_pthread.dylib 0x10d8 thread_start + 8 Thread 0 libsystem_kernel.dylib 0x1808 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x5008 mach_msg2_internal + 80 ...
1
0
462
Aug ’24
DateFormatter not working, If I change the TimeZone in iPhone settings
DateFormatter parses the date correctly when using the default timezone in iPhone settings. However, if I change to any custom TimeZone, DateFormatter returns nil. Here is the code snippet extension String{ func toDate() -&gt; Date?{ let dateFormatter = DateFormatter() dateFormatter.dateFormat = "dd-MMM-yyyy hh:mm a" let date = dateFormatter.date(from:self) return date ?? nil } } If I use the default time zone settings in iPhone Settings, it works. However, if I change the time zone to a custom one and switch to a 24-hour format, DateFormatter returns nil. Sample screenshot attached for the time zone settings.
1
0
312
Aug ’24