What's the Point of (NSError**)error?

后端 未结 6 1102
小蘑菇
小蘑菇 2020-12-16 20:33

Example: The -save: method of NSManagedObjectContext is declared like this:

- (BOOL)save:(NSError **)error

Since

6条回答
  •  情歌与酒
    2020-12-16 20:53

    If you just passed in a pointer, all the method could do would alter the already existing NSError object that you are pointing to.

    By passing in a pointer to a pointer, it can create new NSError objects and leave you with a pointer that points to them.

提交回复
热议问题