Questions tagged [executefetchrequest]
23 questions
3
votes
1 answer
Fetching child sum from Core Data
Lets say I have three Entitys.
Person:
name
address
(to-many-salary) and (to-many-loans)
Salary:
income
tax
Rel: (to-one-Person)
Bills
amount
Rel: (to-one-person)
How do I perform a fetch that have a result like this:
John Doe, SUM>income,…

Vegar Flo
- 61
- 5
2
votes
0 answers
Core-Data: fetching object count from MOC after saving
Im currently having a problem with my CoreData implementation. I try to query the number of objects with certain properties. I therefore execute the following code
NSUInteger itemsCount = [managedObjectContext countForFetchRequest:fetchRequest…

Jan
- 305
- 3
- 10
1
vote
0 answers
swift core data executeFetchRequest always crash with propertiesToGroupBy
i am having a problem with executeFetchRequest when i use propertiesToGroupBy. I need to fetch dates(saved as string) but similar dates should be avoided, so that i get unique date array. below is the code i used
var arrDates: NSArray =…

alrarea
- 110
- 1
- 9
1
vote
1 answer
How to perform conditional 'executeFetchRequest' to fetch only those entities where particular attribute is nil?
I want to execute a fetch request where I should get only those entities in result whose particular attributes have a nil value. (say attribute: firstName). So How will I write it in following format ? Everything I have in place, just want to know…

Tejas
- 1,050
- 12
- 23
1
vote
1 answer
CoreData. Fetchrequest all entities with relations
My main Entity is called Series. Series has a one to many relationship to an entity called Rounds, connected by one-to-many (ordered), and Rounds has again an NSOrderedSet with Shots. The Shots entity has an attribute called score, which is an…

Tom Tallak Solbu
- 559
- 6
- 20
1
vote
0 answers
NSManagedObjectContext? does not have a member named 'executeFetchRequest'
I'm trying to convert my objective-c code:
NSArray *objects = [context executeFetchRequest:request error:&error];
to swift:
var objects : NSArray = context.executeFetchRequest(request, error: &error)
but it doesn't seem to work that way. Any ideas…

user3905950
- 31
- 3
0
votes
1 answer
Why does the raywenderlich code break if you enable the scheme "-com. apple.CoreData.ConcurrencyDebug 1"
This example shows how to extract data asynchronously using coreData. If you run program without scheme "-com. apple.CoreData.ConcurrencyDebug 1" all work, but if you turn on scheme "-com. apple.CoreData.ConcurrencyDebug 1" we get runtime…

Pogos Anesyan
- 55
- 8
0
votes
2 answers
SwiftUI CoreData MVVM resolutes in error "EXC_BAD_INSTRUCTION...."
I'm trying to use a ViewModel between the ContentView and Core Data in SwiftUI. Xcode builder runs the App but I get an immediate error: Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) for var recList.
Can anyone help?
Following a…

schnitz
- 33
- 4
0
votes
1 answer
How to get the filter data result in core data swift 5, with completion handler
I have created the fetch data method in with completion handler and pass the two parameter search text and fetchOfSet but I did not get the response. I have to also sort the record and filter the records as descending order.
func…

Bhavesh Chavda
- 1
- 4
0
votes
0 answers
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[OS_xpc_array length]: unrecognized selector sent
Hi i have a function which fetches data from coreData. Here is the method
- (NSArray *)fetchRequestWithEntity:(NSEntityDescription *)entity
predicate:(NSPredicate *)predicate
sort:(NSArray…

iPhoneDeveloper
- 958
- 1
- 14
- 23
0
votes
3 answers
Crash on [context executeFetchRequest:request error:&error] always in Core Data?
I run my app so always crash on [context executeFetchRequest:request error:&error] because multiple asynchronous data save in core data. So how to handle this problem? I am trying this code.
NSManagedObjectContext *context =[appDelegate…

Mayank Palotra
- 127
- 1
- 8
0
votes
1 answer
Getting crash on FetchRequest in Swift 2.0
I am using CoreData in my application. I created an entity which has two attributes. One is Int type and second one is Transformable Type. I am able to save my record successfully. But when I try to fetch, It get crash. And one more thing,…

Rox
- 909
- 11
- 31
0
votes
0 answers
CoreData NSFetchRequest = nil
I'm new in Swift and I have a problem with a fetch request.
The request is nil, so it doesn't show me the data I want. But I do the same before in the UebungenMuskelgruppenTableViewController and it works. Only the requests in the…

Marcel Spindler
- 13
- 6
0
votes
3 answers
How to retrieve CoreData that satisfies a condition swift 2
I have a DB with fields like below
Latitude Longitude Flag
54.1425 98.2564 0
52.1036 94.1458 3
51.1569 92.1458 3
50.1326 91.1458 3
56.1236 93.1458 0
I need to retrieve records that have flag as 3.
…

Carey
- 139
- 2
- 9
0
votes
0 answers
ManagedObject attributes are nil after second reloadData
I have value:
private var journeysArray : [JourneyInformation]!
In viewWillAppear I load data from Core Data:
let moc = DataController().managedObjectContext
let reqest = NSFetchRequest(entityName: "JourneyInformation")
do {
…

biloshkurskyi.ss
- 1,358
- 3
- 15
- 34