gran33
gran33

Reputation: 12951

iOS - SBJson4Parser - +parserWithBlock:allowMultiRoot:unwrapRootArray:errorHandler: synchronous?

I m using SBJson version 4.0.0.

I parse my JSON by invoke this function (from SBJson documentation):

+ (id)parserWithBlock:(SBJson4ValueBlock)block
       allowMultiRoot:(BOOL)allowMultiRoot
      unwrapRootArray:(BOOL)unwrapRootArray
         errorHandler:(SBJson4ErrorBlock)eh;

And My code is:

SBJson4Parser *parser = [SBJson4Parser parserWithBlock:^(id item, BOOL *stop) {
    NSObject *itemObject = item;
    
    if ([item isKindOfClass:[NSDictionary class]]) {
        self.activitiesDict = (NSDictionary*)itemObject;
    }
}
                                        allowMultiRoot:NO
                                       unwrapRootArray:NO
                                          errorHandler:^(NSError *error) {
                                              NSLog(@"%@", error);
                                          }];
[parser parse:data];

Does the block that I passed to parserWithBlock function is synchronous?

Can I count that the lines after [parser parse:data]; will run after the parser work?

Upvotes: 1

Views: 908

Answers (1)

Stig Brautaset
Stig Brautaset

Reputation: 2632

Yes, the parse: method is synchronous.

Upvotes: 0

Related Questions