Foundation

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

189 results found
Post marked as unsolved
84 Views

iOS CoreFoundation crash with EXC_BAD_ACCESS

Hi, I am facing a strange issue in my app with iOS14 there is a intermittent crash. _CFGetNonObjCTypeID - https://developer.apple.com/forums/content/attachment/076dfe1b-3d07-4fac-bb52-979c31bb62cb _pthread_mutex_fairshare_unlock - https://developer.apple.com/forums/content/attachment/5d91dbe3-eb5d-4a79-94ce-ac868ff39cc4 _CFAssertMismatchedTypeID - https://developer.apple.com/forums/content/attachment/daec3951-5419-46da-963d-7b58215dcdff
Asked
by yuejielin.
Last updated .
Post marked as solved
113 Views

Xcode breaks with SIGCONT before OpenURL handler is called

We define an event handler for OpenURL NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager]; [appleEventManager setEventHandler:self andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; And we handle it here: (void)handleGetURLEvent:(NSAppleEventDescriptor *)event            withReplyEvent:(NSAppleEventDescriptor *)replyEvent { // Handler type stuff } If I'm debugging in Xcode, I see a SIGCONT before the handler is called. When I continue from the SIGCONT, I enter the handler and everything is fine. This causes automated tests to break, and is generally a pain in the you-know-where. Outside of Xcode it's fine. How can I make it stop doing this? Is there some Xcode setting I've overlooked?
Asked
by kjbrock.
Last updated .
Post marked as unsolved
114 Views

[NSAttributedString initWithHtml] crashing on Apple Silicon

Hi, [NSAttributedString initWithHTML:] fails when running natively on Apple Silicon, but doesn't fail when running on Intel. In our app, it crashes with "EXC_BREAKPOINT (code=1, subcode=0x1bade08f4)" on this simple example (a unit test with our app as a host application): (void)testExample {     NSString *string = @"a";     NSData *htmlData = [string dataUsingEncoding:NSUTF8StringEncoding];     NSAttributedString *htmlString = [[NSAttributedString alloc] initWithHTML: htmlData options: @{ NSDocumentTypeDocumentOption: NSHTMLTextDocumentType, NSCharacterEncodingDocumentOption: @(NSUTF8StringEncoding),         }         documentAttributes: nil];     XCTAssertNotNil(htmlString); } The last of the stack trace when this happens look like this: thread #1, name = 'UI', queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=1, subcode=0x1bade08f4)     frame #0: 0x00000001bade08f4 JavaScriptCore`void JSC::LinkBuffer::copyCompactAndLinkCodeunsigned int(JSC::MacroAssembler&, JSC::JITCompilationEffort) + 2784     frame #1: 0x00000001baddfd14 JavaScriptCore`JSC::LinkBuffer::linkCode(JSC::MacroAssembler&, JSC::JITCompilationEffort) + 60     frame #2: 0x00000001bb3e08f0 JavaScriptCore`JSC::nativeForGenerator(JSC::VM&, JSC::ThunkFunctionType, JSC::CodeSpecializationKind, JSC::ThunkEntryType) + 1856     frame #3: 0x00000001bb3cdc80 JavaScriptCore`JSC::JITThunks::ctiStub(JSC::VM&, JSC::MacroAssemblerCodeRef(***::PtrTag)3497 (*)(JSC::VM&)) + 140     frame #4: 0x00000001bb3cde50 JavaScriptCore`JSC::JITThunks::ctiInternalFunctionCall(JSC::VM&) + 36     frame #5: 0x00000001bb6e30b0 JavaScriptCore`JSC::VM::VM(JSC::VM::VMType, JSC::HeapType, ***::RunLoop*, bool*) + 14648     frame #6: 0x00000001bb6e3db0 JavaScriptCore`JSC::VM::create(JSC::HeapType, ***::RunLoop*) + 60     frame #7: 0x00000001bf09d81c WebCore`WebCore::PageScriptDebugServer::PageScriptDebugServer(WebCore::Page&) + 72     frame #8: 0x00000001bf07fb98 WebCore`WebCore::InspectorController::InspectorController(WebCore::Page&, WebCore::InspectorClient*) + 436     frame #9: 0x00000001bf266718 WebCore`WebCore::Page::Page(WebCore::PageConfiguration&&) + 360     frame #10: 0x00000001b913ae48 WebKitLegacy`-[WebView(WebPrivate) _commonInitializationWithFrameName:groupName:] + 2752     frame #11: 0x00000001b92547b8 WebKitLegacy`-[WebView(WebPrivate) _initWithFrame:frameName:groupName:] + 116     frame #12: 0x00000001a8f03568 UIFoundation`-[NSHTMLReader _loadUsingWebKit] + 824     frame #13: 0x00000001a8f02eec UIFoundation`-[NSHTMLReader attributedString] + 32     frame #14: 0x00000001a8eee0b8 UIFoundation`_NSReadAttributedStringFromURLOrData + 7072     frame #15: 0x00000001a8eec48c UIFoundation`-[NSAttributedString(NSAttributedStringUIFoundationAdditions) initWithData:options:documentAttributes:error:] + 156   * frame #16: 0x0000000113e4e860 Tests`-[CrashTests testExample](self=0x0000600002ba5e00, _cmd="testExample") at CrashTests.m:45:38 I am not seeing anything obvious we're doing wrong, or that there should be problems calling [NSAttributedString initWithHTML:] on Apple Silicon. I saw a mention somewhere that it has to happen on the main thread, and this is what we're doing, so I'm not sure why it would crash. Any help wold be appreciated.
Asked
by erik161.
Last updated .
Post marked as unsolved
127 Views

Testing a Locale with custom grouping separator

My app processes numbers, and depends on the grouping separator on the system locale (Locale.current). The user can set a completely custom symbol as their number separator in the macOS System Preferences. In my tests, I need to verify that custom grouping separators on Locale objects work correctly. But I can't set a custom grouping separator as the groupingSeparator property on Locale is read-only:    /// For example, for "en_US", returns ",".   public var groupingSeparator: String? { get } How do I create a Locale object for testing purposes, that will simulate a custom locale the user might have configured in the System Preferences?
Asked
by applezac.
Last updated .
Post marked as unsolved
261 Views

(Expansion) Retrieve articles from an XML parser

Please read the last thread: Call a Class into views - https://developer.apple.com/forums/thread/671482 The right code for the XML parser is almost set in stone, just I need a way to retrieve article data (not just through loadArticles()) like title, author, etc. I've decided, and was suggested, that I go the same route as my other app, Lunch Card, where there's a function where you use a dataUrl and data to call ArticlesParser(). Thing is, since the code for the XML parser is a bit more complicated, it's harder to pass variables around just like with Lunch Card. There's another class I have to deal with. So I either have to (1) redefine articles the same way with an Array; @Published var articles: [ArticleInfo] = [] ...or (2), find some other way to call articles from the ObservableObject, maybe in a StateObject or ObservedObject. I want to try and borrow as much code from Lunch Card as possible, but for an XML parser with multiple classes and extensions, it a bit easier said than done. Here's full code for ArticleInfo and ArticlesView. ArticleInfo.swift - https://developer.apple.com/forums/content/attachment/d16688a9-f420-4dee-b1f4-ed255e325a3eArticlesView - https://developer.apple.com/forums/content/attachment/fbfb99f1-87a7-448b-ad04-54aef6abe61c Not sure how ArticleInfo is an integer, so I have no idea what's going on or why it's not working as well. Also, I'm trying to experiment with borrowing the JSON decoder/encoder code, so tell me if that's the wrong way to go.
Asked
by JoshATA.
Last updated .
Post marked as unsolved
171 Views

Application Hangs on a user's side. Spindupm does not contain any code related to mine(Apple frameworks only)

Can you please give any advice on what to do next? I saw that the app hangs on a remote session. But I don't know what process hangs the app. I do realize that the proper way is to move everything except drawing to the BG queues. But I have a lot of legacy code. And my boss definitely isn't going to pay for overriding the whole app. And even then I can't guaranty the problem be solved. Spindump: End time:&#9;&#9;&#9;&#9; 2021-01-29 15:58:32.475 +0100\ OS Version:&#9;&#9;&#9; macOS 11.1 (Build 20C69)\ Architecture:&#9;&#9; arm64e\ Report Version:&#9; 32\ Share With Devs:&#9;Yes\ \ Data Source:&#9;&#9;&#9;Stackshots\ Shared Cache:&#9;&#9; 64510D3B-D7B4-3C73-803C-AD9F01B790AD slid base address 0x18f298000, slide 0xf298000\ Shared Cache:&#9;&#9; E2B1A630-68DD-30AC-A036-6AC018B154DA slid base address 0x7fff20094000, slide 0x94000\ \ Command:&#9;&#9;&#9;&#9;&#9;MyApp\ Path:&#9;&#9;&#9;&#9;&#9;&#9; /private/var/folders/*/MyApp.app/Contents/MacOS/MyApp\ Identifier:&#9;&#9;&#9; com.companyname.myappid\ Version:&#9;&#9;&#9;&#9;&#9;7.3.1 (815)\ Parent:&#9;&#9;&#9;&#9;&#9; launchd [1]\ PID:&#9;&#9;&#9;&#9;&#9;&#9;&#9;2264\ Time Since Fork:&#9;464s\ Note:&#9;&#9;&#9;&#9;&#9;&#9; Translocated\ \ Event:&#9;&#9;&#9;&#9;&#9;&#9;hang\ Duration:&#9;&#9;&#9;&#9; 446.85s\ Duration Sampled: 4.70s (process was unresponsive for 442 seconds before sampling)\ Steps:&#9;&#9;&#9;&#9;&#9;&#9;47 (100ms sampling interval)\ Report threshold: 2.5s\ \ Hardware model:&#9; MacBookAir10,1\ Active cpus:&#9;&#9;&#9;8\ \ Time Awake Since Boot: 2536s\ Time Since Wake:&#9;n/a (machine hasn't slept)\ \ \-------------------------------------------------\ Timeline format: stacks are sorted chronologically\ Use -i and -heavy to re-report with count sorting\-------------------------------------------------\ \ \ Heaviest stack for the main thread of the target process:\ &#9;47&#9;<truncated backtrace>\ &#9;47&#9;-[NSBundle initWithPath:] + 392 (Foundation + 15300) [0x1903a1bc4]\ &#9;47&#9;access + 8 (libsystem_kernel.dylib + 5952) [0x18f548740]\47&#9;??? (kernel.release.t8101 + 30696) [0xfffffe0007c137e8]\ 47&#9;??? (kernel.release.t8101 + 1447416) [0xfffffe0007d6d5f8]\ 47&#9;??? (kernel.release.t8101 + 6596008) [0xfffffe00082565a8]\ 47&#9;??? (kernel.release.t8101 + 2786396) [0xfffffe0007eb445c]\ 47&#9;??? (kernel.release.t8101 + 2785876) [0xfffffe0007eb4254]\ 47&#9;kauth_authorize_action + 252 (kernel.release.t8101 + 5274992) [0xfffffe0008113d70]\ 47&#9;VnodeScopeListener + 1000 (AppleFileUtil + 51028) [0xfffffe0008b98754]\ 47&#9;Placeholders_Hydrate + 304 (AppleFileUtil + 54376) [0xfffffe0008b99468]\ 47&#9;_Placeholders_Hydrate_Wait_For_Completion + 284 (AppleFileUtil + 56540) [0xfffffe0008b99cdc]\ 47&#9;Tickets_WaitOnTicketResponse + 732 (AppleFileUtil + 10076) [0xfffffe0008b8e75c]\ 47&#9;Kernel_Cond_Wait + 64 (AppleFileUtil + 45928) [0xfffffe0008b97368]\ 47&#9;??? (kernel.release.t8101 + 5591856) [0xfffffe0008161330]\ 47&#9;lck_mtx_sleep_deadline + 132 (kernel.release.t8101 + 395372) [0xfffffe0007c6c86c]\ 47&#9;??? (kernel.release.t8101 + 462928) [0xfffffe0007c7d050]\ 47&#9;??? (kernel.release.t8101 + 468128) [0xfffffe0007c7e4a0]\ &#9;Binary Images:\ &#9;&#9;&#9;&#9;&#9; 0x1025ec000 -&#9;&#9;&#9;&#9;0x102afbfff&#9;com.companyname.myappid 7.3.1 (815)&#9;<D7CFCE67-1556-322E-A82B-64604ECBB0E3>&#9;&#9;&#9;&#9;&#9;&#9;&#9;/private/var/folders/*/MyApp.app/Contents/MacOS/MyApp\ &#9;&#9;&#9;&#9;&#9; 0x18f547000 -&#9;&#9;&#9;&#9;0x18f579fff&#9;libsystem_kernel.dylib (7195.60.75)&#9;&#9;&#9;<35BFD663-2C38-3E0F-A35E-8C1BC6400898>&#9;&#9;&#9;&#9;&#9;&#9;&#9;/usr/lib/system/libsystem_kernel.dylib\ &#9;&#9;&#9;&#9;&#9; 0x18f57a000 -&#9;&#9;&#9;&#9;0x18f585fff&#9;libsystem_pthread.dylib (454.60.1)&#9;&#9;&#9; <EDB716F3-BF94-3941-B7DA-D6C91094C645>&#9;&#9;&#9;&#9;&#9;&#9;&#9;/usr/lib/system/libsystem_pthread.dylib\ &#9;&#9;&#9;&#9;&#9; 0x18f5f8000 -&#9;&#9;&#9;&#9;0x18faa1fff&#9;com.apple.CoreFoundation 6.9 (1770.300)&#9;<396F9604-7574-3C1B-ACA7-C7EB24FE3544>&#9;&#9;&#9;&#9;&#9;&#9;&#9;/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation\ &#9;&#9;&#9;&#9;&#9; 0x19039e000 -&#9;&#9;&#9;&#9;0x19072ffff&#9;com.apple.Foundation 6.9 (1770.300)&#9;&#9;&#9;<5CEA7350-F274-39AE-9F27-D9813F2C3A76>&#9;&#9;&#9;&#9;&#9;&#9;&#9;/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation\ &#9;&#9;&#9;&#9;&#9; 0x191e10000 -&#9;&#9;&#9;&#9;0x192b6efff&#9;com.apple.AppKit 6.9 (2022.20.119)&#9;&#9;&#9; <78F21674-643E-3793-B1CD-C8BDBC76BAD5>&#9;&#9;&#9;&#9;&#9;&#9;&#9;/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit\ &#9; *0xfffffe0007c0c000 - 0xfffffe00083f7fff&#9;kernel.release.t8101 (7195.60.75)&#9;&#9;&#9;&#9;<48F71DB3-6C91-3E62-9576-3A1DCEF2B536>__TEXT_EXEC&#9; /System/Library/Kernels/kernel.release.t8101\ &#9; *0xfffffe0008b8c000 - 0xfffffe0008b9ffff&#9;com.apple.fileutil 20.036.15 (20.036.15) <73495C49-0EF7-3EA5-ADC9-0BD2D90305A0>__TEXT_EXEC&#9; /System/Library/Extensions/AppleFileUtil.kext/Contents/MacOS/AppleFileUtil\ &#9; *0xfffffe000a9d8000 - 0xfffffe000a9dffff&#9;com.apple.kec.pthread 1.0 (1)&#9;&#9;&#9;&#9;&#9;&#9;<EEB71141-5752-31E8-8495-2AF64D829A69>__TEXT_EXEC&#9; /System/Library/Extensions/pthread.kext/Contents/MacOS/pthread\
Asked
Last updated .
Post marked as unsolved
69 Views

DateFormatter doesn't Works

Hi! I don't know why, but the date from formatter is nil. let date1 = "22/05/1977" let date2 = "01/06/1975" let date3 = "26/05/1974" let formatter = DateFormatter() formatter.dateFormat = "dd/MM/yyyy" let d1 = formatter.date(from: data1) let d2 = formatter.date(from: data2) let d3 = formatter.date(from: data3) why d1, d2 and d3 will be nil ?
Asked
by mdm84.
Last updated .
Post marked as solved
232 Views

(Expansion) Call a Class into views

Please read the last thread: Parse XML in SwiftUI - https://developer.apple.com/forums/thread/670984 I've got the code to parse articles from XML courtesy of OOPer...but I need to actually execute it in ArticlesView. How would I call ArticlesParser into ArticlesView and related views and run the parser onto an XML file (THS.xml)? Here's ArticleInfo.swift and ArticlesView. ArticleInfo.swift: // //  ArticleInfo.swift //  Hair Society Go // //  Created by Joshua Srery on 1/13/21. //  Code provided by OOPer on Apple Developer Forums // import Foundation struct Article {     var title: String = ""     var date: Date?     var author: String?     var img: URL?     /// content in HTML     var content: String = "" } class ArticlesParser: XMLParser {     // Public property to hold the result     var articles: [Article] = []          var dateTimeZone = TimeZone(abbreviation: "GMT-6")     lazy var dateFormater: DateFormatter = {         let df = DateFormatter()         //Please set up this DateFormatter for the entry `date`         df.locale = Locale(identifier: "en_US_POSIX")         df.dateFormat = "MMM dd, yyyy"         df.timeZone = dateTimeZone         return df     }()          private var textBuffer: String = ""     private var nextArticle: Article? = nil     override init(data: Data) {         super.init(data: data)         self.delegate = self     } } extension ArticlesParser: XMLParserDelegate {          // Called when opening tag (`<elementName>`) is found     func parser(_ parser: XMLParser, didStartElement elementName: String, namespaceURI: String?, qualifiedName qName: String?, attributes attributeDict: [String : String] = [:]) {         switch elementName {         case "posts":             nextArticle = Article()         case "title":             textBuffer = ""         case "date":             textBuffer = ""         case "author":             textBuffer = ""         case "img":             textBuffer = ""         case "content":             textBuffer = ""         default:             print("Ignoring \(elementName)")             break         }     }          // Called when closing tag (`</elementName>`) is found     func parser(_ parser: XMLParser, didEndElement elementName: String, namespaceURI: String?, qualifiedName qName: String?) {         switch elementName {         case "posts":             if let article = nextArticle {                 articles.append(article)             }         case "title":             nextArticle?.title = textBuffer         case "date":             print("date: \(textBuffer)")             nextArticle?.date = dateFormater.date(from: textBuffer)         case "author":             nextArticle?.author = textBuffer         case "img":             print("img: \(textBuffer)")             nextArticle?.img = URL(string: textBuffer)         case "content":             nextArticle?.content = textBuffer         default:             print("Ignoring \(elementName)")             break         }     }          // Called when a character sequence is found     // This may be called multiple times in a single element     func parser(_ parser: XMLParser, foundCharacters string: String) {         textBuffer += string     }          // Called when a CDATA block is found     func parser(_ parser: XMLParser, foundCDATA CDATABlock: Data) {         guard let string = String(data: CDATABlock, encoding: .utf8) else {             print("CDATA contains non-textual data, ignored")             return         }         textBuffer += string     }          // For debugging     func parser(_ parser: XMLParser, parseErrorOccurred parseError: Error) {         print(parseError)         print("on:", parser.lineNumber, "at:", parser.columnNumber)     } } ArticlesView: // //  ArticlesView.swift //  Hair Society Go // //  Created by Joshua Srery on 11/29/20. // import SwiftUI struct ArticlesView: View {     var body: some View {         NavigationView {             List {                 ForEach(0 ..< 5) { item in                     NavigationLink(destination: ArticleView(title: "Replace with Title var", image: "Replace with Img var", content: "Replace with Content var", author: "Replace with Author var", date: "Replace with Date var")) {                         ArticleRow(image: "Replace with Img var", title: "Replace with Title var", author: "Replace with Author var", date: "Replace with Date var")                     }                 }             }             .navigationTitle("Articles")             .toolbar(content: {                 Menu {                     Button("Date", action: {})                     Button("Title", action: {})                     Button("Customize…", action: {})                 } label: {                     Label("Filter", systemImage: "line.horizontal.3.decrease.circle")                 }             }) // Ignore the filter Menu for right now         }     } } struct ArticleRow: View {     let image: String     let title: String     let author: String     let date: String          var body: some View {         HStack {             Image(image)                 .resizable()                 .frame(minWidth: 75, maxWidth: 100, maxHeight: 75)                 .cornerRadius(12)             VStack(alignment: .leading, content: {                 Text(title)                     .font(.headline)                 Text("\(author) • \(date)")                     .font(.subheadline)             })         }     } }
Asked
by JoshATA.
Last updated .
Post marked as unsolved
1.2k Views

iOS 14 CoreFoundation crash with EXC_BREAKPOINT

Hi, I am facing a strange issue in my app with iOS14 there is a intermittent crash, i am using NetServiceBrowser for MDNS discovery not sure if that is causing the problem crash log has below information: Crashed: com.apple.main-thread 0 CoreFoundation 0x1a906c4c4 CFAssertMismatchedTypeID + 108 1 CoreFoundation 0x1a8f7db0c CFRunLoopSourceRemoveFromRunLoop + 298 2 CFNetwork 0x1a96255b0 CFNetServiceBrowserStopSearch + 460 3 CoreFoundation 0x1a8f81240 CFRUNLOOPISCALLINGOUTTOASOURCE0PERFORMFUNCTION + 24 4 CoreFoundation 0x1a8f81140 CFRunLoopDoSource0 + 204 5 CoreFoundation 0x1a8f80488 CFRunLoopDoSources0 + 256 6 CoreFoundation 0x1a8f7aa40 CFRunLoopRun + 776 7 CoreFoundation 0x1a8f7a200 CFRunLoopRunSpecific + 572 8 GraphicsServices 0x1bf075598 GSEventRunModal + 160 9 UIKitCore 0x1ab840004 -[UIApplication run] + 1052 10 UIKitCore 0x1ab8455d8 UIApplicationMain + 164
Asked
Last updated .
Post marked as unsolved
110 Views

issues for parsing xml data in swift 5 with NSRegularExpression

Hello ! i have some issues for extract datas from an HTTP request, please can you help me ?? 1)I send a request for asking the datas from a local device : language http://192.168.2.1/data/ 2) below the device send this result in xml language ?xml version="1.0" encoding="UTF-8" ? !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" head titleIndex of /data/100CAMBX//title /head body h2Index of /data/100CAMBX//h2 div class="list" table summary="Directory Listing" cellpadding="0" cellspacing="0" thead tr th class="n"Name/th th class="m"Last Modified/th th class="s"Size/th th class="t"Type/th /tr /thead tbody tr class="d" td class="n" a href="../"Parent Directory/a//td td class="m"&amp;nbsp;/td td class="s"- &amp;nbsp;/td td class="t"Directory/td /tr tr td class="n" a href="Video1.MOV"CMBX0007.MOV/a /td td class="m"2000-Jan-01 22:46:48/td td class="s"1.5G/td td class="t"video/quicktime/td /tr tr td class="n" a href="CMBX0009.MOV"CMBX0009.MOV/a /td td class="m"2000-Jan-13 08:28:24/td td class="s"92.4M/td td class="t"video/quicktime/td /tr tr td class="n" a href="CMBX0010.MOV"CMBX0010.MOV/a /td td class="m"2021-Mar-10 16:53:18/td td class="s"1.8M/td td class="t"video/quicktime/td /tr /tbody /table /div div class="foot"lighttpd/1.4.41/div /body /html 3) i want to extract in this file theses 5 values integrate in the body language th class="n"Video1.MOV/th. //title of the video th class="n"CMBX0007.MOV/th. // filename video th class="m"2000-Jan-01 22:46:48/th //date&amp;time th class="s"1.5G/th // video size th class="t"Type/th // video type I need also to create an loop function for getting these 5 parameters for each videos files and store them in a structure. everybody can help me please ?
Asked
by CAMBOX44.
Last updated .
Post marked as solved
218 Views

How to read property list (binary format) if the iOS fails to load it via NSPropertyListSerialization

In my App I work with a "tree" structure (nested NSArrays and NSDictionaries) and have stored them in the file system using NSPropertyListSerialization, which always works fine. In general loading the same structure via NSPropertyListSerialization works fine too, but if the "tree" is getting larger (nested deeper), NSPropertyListSerialization can no longer read the file (even if it was able to saved it without error before). It will fail with the error "Too many nested arrays or dictionaries". The issue seems to be the nesting level, not the general amount of nodes in the property list, because the file itself is very small (about 50 KB) . I've never seen this in the past, so this might be a new issue of iOS 14. So my question is: is there another way to read the propertylist file? The problem is that the file is stored in the binary format (not the plain XML format), so just using a general XML parser is not an option, the binary file format seems to be undocumented by Apple.
Asked
Last updated .
Post marked as solved
221 Views

URLSession Task Publisher / TaskDelegate / Metrics

Using the Combine URLSessionTask Publisher, is there a way to still access a reference to the URLSessionTask to set a delegate? What I'm trying to do is collect network metrics by handling the delegate calls of URLSession did finish collecting metrics.
Asked
Last updated .
Post marked as solved
884 Views

DispatchQueue.current

hello, i don't think it is provided by the system already so i'd like to implement a smart version of DispatchQueue.async function - the one that will not reschedule the block if i am already on the queue in question and call the block directly instead in this case.  extension DispatchQueue { func asyncSmart(execute: @escaping () -> Void) { if DispatchQueue.current === self { // ????? execute() } else { async(execute: execute) } } } the immediate problem is that there is no way to get the current queue (in order to compare it with the queue parameter and do the logic branch). anyone've been through it and solved this puzzle?
Asked
Last updated .
Post marked as unsolved
229 Views

NSTaggedPointerString

Dear Team, We are receiving the below crash from Crashlytics in recent times, Could you please confirm on the reason behind and how that can be avoided Fatal Exception: NSInvalidArgumentException[NSTaggedPointerString stringByReplacingCharactersInRange:withString:]: nil argument 0 CoreFoundation __exceptionPreprocess 1 libobjc.A.dylib objc_exception_throw 2 Foundation [NSUserDefaults(NSUserDefaults_NSURLExtras) _web_defaultsDidChange] 3 TextInput[TIDocumentState(StateTransitions) documentStateAfterReplacingText:withText:] 40 UIKitCore UIApplicationMain 41 main + 33 42 libdyld.dylib start A quick help will be much appreciated.
Asked
Last updated .
Post marked as solved
158 Views

Best practice for storing repeating dates in CoreData

Hello everyone, I have an app that lets users create and save meeting information. They can enter a date and set a repeat (like Apple's calendar app) if the meeting repeats every week, every month, every day, etc. I'm storing these dates in CoreData using a date attribute. My questions are: Can I store an array of dates in one date attribute in CoreData? How should I create a repeating rule for the dates? Right now, I let users choose a repeat by using a picker: Picker("Repeats", selection: $repeats) {        Text("Every week").tag("1")        Text("Every month").tag("2")        Text("Every day").tag("3") } I'm thinking this will probably involve a few if statements (e.g. if repeats == 1, set this rule, else if repeats == 2, set this rule, etc.) But what would this rule look like?
Asked
by Hu is I.
Last updated .