Posts

Post not yet marked as solved
5 Replies
4.6k Views
Any one getting any issues with NavigaitonLink to seemingly innocuous views freezing when tapped on? 1 CPU at 100% memory steadily increasing until app gets killed by the system. Will freeze if any NavigationLink on the view is tapped if certain views are linked to using NavigaitonLink. I note some people have been getting similar freezes if they use @AppStorage, but I'm not using @AppStorage. I do use CoreData tho. tho I have some views that use core data that don't freeze. https://developer.apple.com/forums/thread/708592?page=1#736374022 has anyone experienced similar issues? or know the cause. it doesn't seem to be any of my code because if I pause the debugger it stops on system code.
Posted
by ngb.
Last updated
.
Post not yet marked as solved
2 Replies
724 Views
How do I safely access Core data NSManagedObject attributes from SwiftUI view using the swift concurrency model. My understanding is we need to enclose any access to NSManageObject attributes in await context.perform {}. But if I use it anywhere in a view be that in the body(), or init() or .task() modifier I get the following warnings or errors: for .task{} modifier or if within any Task {}: Passing argument of non-sendable type 'NSManagedObjectContext.ScheduledTaskType' outside of main actor-isolated context may introduce data races this happens even if I create a new context solely for this access. if within body() or init(): 'await' in a function that does not support concurrency but we cant set body or init() to async an example of the code is something along the lines of: var attributeString: String = "" let context = PersistentStore.shared.persistentContainer.newBackgroundContext() await context.perform { attributeString = nsmanagedObject.attribute! }
Posted
by ngb.
Last updated
.
Post not yet marked as solved
0 Replies
480 Views
anyone know how to use the new swift concurrency model (ie. await context.perform and context.perform) core data willSave()? for example. how would I ensure this is thread safe? changing self.managedObjectContext!.performAndWait to await self.managedObjectContext!.perform means I have to change willSave() to async which then means it never gets called because its not overriding the correct method anymore. override public func willSave() { self.managedObjectContext!.performAndWait { if self.modifiedDate == nil || Date().timeIntervalSince(self.modifiedDate!) >= 1 { self.modifiedDate = Date() } } super.willSave() }
Posted
by ngb.
Last updated
.
Post not yet marked as solved
0 Replies
488 Views
getting the following error with Xcode 15 final/ios17 final nw_parameters_set_source_application_by_bundle_id_internal Failed to convert from bundle ID (com.***.***) to UUID. This could lead to wrong data usage accounting. anyone know how to fix?
Posted
by ngb.
Last updated
.
Post marked as solved
1 Replies
408 Views
Anyone know the correct usage for CKQueryOperation.recordMatchedBlock and .queryResultBlock? Xcode is telling me to use them as the old .recordFetchedBlock and .queryCompletionBlock are deprecated, but there isn't any documentation to say how they should be used. ChatGPT, Bard etc aren't able to provide a correct answer either: specifically, I need to convert the following to use those methods: operation.recordFetchedBlock = { record in // Convert CKRecord to Core Data object and save to Core Data self.saveToCoreData(record: record) } operation.queryCompletionBlock = { (cursor, error) in // Handle potential errors if let error = error { print("Error syncing first of month records: \(error)") } if let cursor = cursor { // There are more records to fetch for this category, continue fetching self.continueSyncing(cursor: cursor, completion: completion) } else { // Done syncing this category, move to the next sync task completion() } }
Posted
by ngb.
Last updated
.
Post not yet marked as solved
1 Replies
1k Views
anyone getting the following error with CloudKit+CoreData on iOS16 RC? delete/resintall app, delete user CloudKit data and reset of environment don't fix. [error] error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _requestAbortedNotInitialized:](2044): <NSCloudKitMirroringDelegate: 0x2816f89a0> - Never successfully initialized and cannot execute request '<NSCloudKitMirroringImportRequest: 0x283abfa00> 41E6B8D6-08C7-4C73-A718-71291DFA67E4' due to error: Error Domain=NSCocoaErrorDomain Code=4864 "*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: incomprehensible archive (0x53, 0x6f, 0x6d, 0x65, 0x20, 0x65, 0x78, 0x61)" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: incomprehensible archive (0x53, 0x6f, 0x6d, 0x65, 0x20, 0x65, 0x78, 0x61)}
Posted
by ngb.
Last updated
.
Post not yet marked as solved
1 Replies
1.9k Views
so ive got an actor that im using to control concurrent access to some shared data. I have a second actor that controls concurrent access to another set of different shared data actor DataManager { static let shared = DataManager() func fetchData() async { modifySomeData() let blah = await SecondDataManager.shared.fetchDifferentData() } } actor SecondDataManager { static let shared = SecondDataManager() func fetchDifferentData() -&gt; [SomeData] { return stuff } } im finding that because of the await in the fetchData() method, the actor no longer ensures that the DataManager.fetchData() function can only be executed one at a time thus corrupting my shared data because fetchData() needs to be async due to the call on the second actor method. Any way to ensure DataManager.fetchData() can only be executed one at a time? normally id use a DispatchQueue or locks. but it seems these can't be combined with actors.
Posted
by ngb.
Last updated
.
Post not yet marked as solved
0 Replies
1.1k Views
Get this warning compiling with ios16 b5. anyone know what this is? no warning on ios15. Capture of 'notification' with non-sendable type 'NSNotification' in a @Sendable closure The line it shows on is: let myObject = notification.object as! MyObject I also noticed that NSNotificationCenter notifications in general seem to have broken in iOS16 betas. Are they getting removed?
Posted
by ngb.
Last updated
.
Post marked as solved
1 Replies
2.8k Views
anyone been able to get rid of this error? A navigationDestination for <App.Entity> was declared earlier on the stack. Only the destination declared closest to the root view of the stack will be used. Seems to happen when im using a NavigationLink(value:) and a NavigationLink(destination:) in the same class. I'd think it would make sense to be able to use both methods? ios16 b5
Posted
by ngb.
Last updated
.
Post marked as solved
2 Replies
1.1k Views
So I have a navigationStack which has a NavigationLink that navigates to the next view. That view then has its own NavigationLink that navigate to a 3rd view. if the user clicks on the back button on the 3rd view (View3) to return to the previous view (View 2), it goes right back to the starting view (View 1). an one else have this issue or know how to fix? ios16b1 example below: View 1: NavigationStack {                 View2()                     .navigationTitle("View 2")             } View 2: List {        VStack (alignment: .leading) {                     NavigationLink("View 3", destination: {                         View3()                     }) } }
Posted
by ngb.
Last updated
.
Post not yet marked as solved
1 Replies
1k Views
Is it possible to put a pause in Siri's responses to an AppIntent? in the code below id like Siri to pause a bit longer than she does between sentence one and sentence two. i've tried using "..." and multiple "." similar to what she does when she's responding to "how is the market" if you ask a HomePod - she pauses a bit longer between her comments on each market, a bit more than an end of sentence - more like the pause between each point when you are going through a list of bullet points - which is really what i'm using this for. Also is it possible to hide all or part of of the dialog text displayed? so she says it but doesn't show it. I've got a view which shows a better formatted representation of what she says than the text itself. struct TestAppIntent: AppIntent {     static var title: LocalizedStringResource = "A question?"     static var openAppWhenRun: Bool = false     @MainActor     func perform() async throws -> some IntentResult {         return .result(             dialog: "sentence one. sentence two", view: someView()         )     } }
Posted
by ngb.
Last updated
.
Post marked as solved
3 Replies
4.4k Views
anyone figured out how to customise the Y axis values? id like to be able to process the. axis values and. then display them in the. format id like. eg. "1000" I'd like to display as "1k" the furthest Ive been able to get is to get the axis to display a static text as the number ie "Y" in the code below. but I haven't been able to access the value. in the code below 'value' seems to be an AxisValue which stores the value but I can't seem to access it in a format I can process. .chartYAxis {                 AxisMarks() { value in                     AxisGridLine()                     AxisTick()                     AxisValueLabel {                     Text("Y")                     }                 }             } id like to be able to do something like this: .chartYAxis {                 AxisMarks() { value in                     AxisGridLine()                     AxisTick()                     AxisValueLabel {                         if value > 1000000000000.0 {                             Text("\(value / 1000000000000.0)t")                         } else if value > 1000000000.0 {                             Text("\(value / 1000000000.0)b")                         } else if value > 1000000.0 {                             Text("\(value / 1000000.0)m")                         } else if value > 1000.0 {                             Text("\(value / 1000.0)k")                         }                     }                 }             }
Posted
by ngb.
Last updated
.
Post not yet marked as solved
2 Replies
1.2k Views
Anyone know how to load a large number of records into the CloudKit public database? I need to load 1.2million records (about 150Mb) into the public database. no binary data. basically just a bunch of exchange rates that I need to have available to all my users. I've been trying for months. have tried: loading into core data on a device or simulator individually or in batches ranging from 400 records to 2500 (more than that exceeds batch size limits). it will start to sync and then stop. can often get it to restart by restarting device or similator but will eventually corrupt the database in iCloud requiring a reset of the environment. generally can get the load to go for a few days and load maybe 500k records before it breaks. to do that have to put delays up to a minute between batches loaded into core data. have tried doing it using the CloudKit.js framework and loading from a server. this works for a small number of records. but limits are really small doing it through that interface. after a while it locks you out. don't get anywhere near the number of records I need to load. I'm stuck. has anyone found a way? same issue on all versions of iOS - 14, 15, 16b1
Posted
by ngb.
Last updated
.
Post not yet marked as solved
0 Replies
837 Views
in Xcode iOs15 beta 2 the .tag modifier in a ForEach statement gives the following compile error "The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions" the error shows up on the .navigationBarTitle line but its due to the .tag line works fine on all previous releases. anyone know how to fix? code example below func content() -> some View {         let rentFrequencies = RentFrequency.allCases         return List {             ForEach(rentFrequencies, id: \.self) { rentFrequency in                 if rentFrequency != RentFrequency.NoFrequency {                     HStack() { Text(rentFrequency.name).tag(rentFrequency.id) // Including this tag makes it not compile                         if rentFrequency == type {                             Spacer()                             Image(systemName: "checkmark") .foregroundColor(.accentColor)                         }                     }                     .onTapGestureForced(perform: { self.type = rentFrequency })                     .frame(width: nil, height: 32.0)                 }             }         } .listStyle(InsetGroupedListStyle())         .navigationBarTitle("Rent Frequency")     }
Posted
by ngb.
Last updated
.