Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8799259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:16:39+00:00 2026-06-14T00:16:39+00:00

The code works fine in iOS5+: NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@FooBar]; request.sortDescriptors = [NSArray

  • 0

The code works fine in iOS5+:

NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"FooBar"];
request.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"ident"
                                                                                 ascending:NO
                                                                                  selector:@selector(compare:)]];
request.predicate = [NSPredicate predicateWithFormat:@"xxx = %@", @"yyy"];

self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:request
                                                                    managedObjectContext:model.managedObjectContext
                                                                      sectionNameKeyPath:nil
                                                                               cacheName:nil];

But in iOS 4, I got the following error:

'NSObjectInaccessibleException', reason: 'This fetch request (0x70d4700) 
was created with a string name (FooBar), and cannot respond to -entity 
until used by an NSManagedObjectContext'

2012-11-08 12:12:18.093 hello[1566:11d03] *** Terminating app due to uncaught
exception 'NSObjectInaccessibleException', reason: 'This fetch request 
(0x70d4700) was created with a string name (FooBar), and cannot respond 
to -entity until used by an NSManagedObjectContext'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x012405a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x0104a313 objc_exception_throw + 44
    2   CoreData                            0x000be68f -[NSFetchRequest entity] + 159
    3   CoreData                            0x0019f7fb -[NSFetchedResultsController initWithFetchRequest:managedObjectContext:sectionNameKeyPath:cacheName:] + 763
    ...

How can I resolve this error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:16:40+00:00Added an answer on June 14, 2026 at 12:16 am

    fetchRequestWithEntityName: is available only in iOS 5 and later.

    On iOS 4, you have to create a NSEntityDescription first:

    NSEntityDescription *fooBarEntity = [NSEntityDescription entityForName:@"FooBar" inManagedObjectContext:model.managedObjectContext];
    NSFetchRequest *request = [[NSFetchRequest alloc] init];
    [request setEntity:fooBarEntity];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got a strange issue , the below code works fine in IOS5
This code works fine in Chrome. However, in Firefox, when it hits the GMxhr
This code works fine, but I'll want to handle exception if any thing goes
this code works fine until I start scrolling: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
This code works fine to find an available room within certain date, but it
This code works fine in C#: Expression.Lambda(LambdaBody); But none of the methods for building
My code works fine when I call AA.sendRequest() from the console, but not when
The following code works fine on Linux but throws an exception on OS X
The following code works fine in firefox but as with many other things, I
the following piece of code works fine when i use it among some code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.