StackKit
StackKit copied to clipboard
Error with no entity on fetch request
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'executeFetchRequest:error: A fetch request must have an entity.'
*** Call stack at first throw:
(
0 CoreFoundation 0x012f3be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x014485c2 objc_exception_throw + 47
2 CoreData 0x010215fa -[NSManagedObjectContext executeFetchRequest:error:] + 3930
3 iStack iPad 0x0003db5a +[SKObject objectMergedWithDictionary:inSite:] + 890
4 iStack iPad 0x0004c9d6 -[SKFetchOperation requestObjectsFromURL:] + 2358
5 iStack iPad 0x0004d21b -[SKFetchOperation main] + 971
6 Foundation 0x00121bd2 -[__NSOperationInternal start] + 747
7 Foundation 0x00121826 ____startOperations_block_invoke_2 + 106
8 libSystem.B.dylib 0x91629024 _dispatch_call_block_and_release + 16
9 libSystem.B.dylib 0x9161b2f2 _dispatch_worker_thread2 + 228
10 libSystem.B.dylib 0x9161ad81 _pthread_wqthread + 390
11 libSystem.B.dylib 0x9161abc6 start_wqthread + 30
)
terminate called after throwing an instance of 'NSException'
I'm just calling this code:
SKFetchRequest *request = [[SKFetchRequest alloc] init];
[request setEntity:[SKQuestion class]];
[request setFetchLimit:25];
[stackSite executeFetchRequest:request withCompletionHandler:^(NSArray *results){ [self reloadWithQuestions:results];}];
I'm guessing it has to do with loading the managed object model.
See this StackOverflow post for more information.
In the meantime, I suppose you can just copy the .xcdatamodeld file into your project and compile it in yourself. I'll try and work up a better solution, though.
I'll leave this issue open to remind me that this needs doing.