Search code examples
iphoneiosobjective-cnsurl

How to convert this to nsurl?


How do I convert this into an nsurl. This is ripped off from the rest kit example and this would work, but I need to fetch data from .json on a website and not a local .json file (that is what the example file is doing).

   - (NSFetchedResultsController *)newFetchedResultsController
  {
   NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"Contact"];
fetchRequest.sortDescriptors = @[ [NSSortDescriptor sortDescriptorWithKey:@"firstName" ascending:YES] ];
NSFetchedResultsController *fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
                                                                                           managedObjectContext:self.managedObjectContext
                                                                                             sectionNameKeyPath:nil
                                                                                                      cacheName:nil];
fetchedResultsController.delegate = self;
return fetchedResultsController;
   }

Solution

  • Nothing in this code would translate to a NSURL, much less a URL string.

    Perhaps the results from the fetchedResultsController might have a URL in it, though. That would require showing more code, or at least something that displays the kind of things the "Contact" entity holds.