Thursday, 15 May 2014

objective c - NSError objects with NSFetchedResultsControllers -


This is a simple one: I am currently using a new NSError object every time I Make a fetch on NSFetchedResultsController . It happens in many ways, so currently I have 9 main view controllers, do I create a NSError as a property and use it, or what every time you use it So, to make a new one, it is more conventionally accepted?

I am taking advantage of this to build multiples that if you get more than one error, you can get it independently on both, but if this is not likely to happen then what Is the use of sharing for all forFetch calls acceptable? I am learning a lot of programming conferences and techniques, so if it is a non-issue then I apologize, I would just like to get some feedback on a more specific approach to using the NSError objects Different types of places

You are not actually creating NSError objects are declaring references of objects and then passing a reference to a method, which creates a reference which creates an NSError object.

  NSError * err; // just a reference, no object created / it creates an object, but you do not do that = [nserro error: dadmin: @ "afu" code: 0 user ink: nil]; // You do this .... BOOL success = [fetchedResultsController performFetch: & amp ;;];   

The distinction is that you are not actually creating a bunch of objects that require overhead. So if you reuse the same variable for all of them or you create a new variable for each one, then it is not affecting the display.

To answer the question ... either use 1 or the variable that you see fit. Some code may fail on any error and may refuse to continue so 1 error is OK. Try other code and continue so that you can keep all the errors and finally remove them. This is the case of the time that best fits with specific coding working at that time.

No comments:

Post a Comment