1

Need some help with the following objective-c syntax:

[error.userInfo[FBErrorParsedJSONResponseKey][@"body"][@"error"][@"type"] isEqualToString:@"OAuthException"]

Whats going on here? How are body,error and type literals being used?

Here's the complete block call:

[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
    if (!error) {
        // handle successful response
    } else if ([error.userInfo[FBErrorParsedJSONResponseKey][@"body"][@"error"][@"type"] isEqualToString:@"OAuthException"]) { 
        NSLog(@"The facebook session was invalidated");
        [self logoutButtonTouchHandler:nil];
    } else {
        NSLog(@"Some other error: %@", error);
    }
}];

I have also seen syntax like

self.userProfile = [PFUser currentUser][@"profile"];

where userProfile is an NSDictionary and [PFUser currentUser] returns PFUser. How does [PFUser][@"profile] initialize a dictionary?

bilalm
  • 33
  • 4
  • 1
    @H2CO3: I guess you are mistaken the "thanks" wasn't my edit. – Gayu Mar 28 '13 at 07:55
  • 2
    @Gayu Then why is "Thanks" in green in the diff under your edit? – CodaFi Mar 28 '13 at 07:58
  • @Gayu [This](http://stackoverflow.com/posts/15676618/revisions) says it was yours. –  Mar 28 '13 at 07:58
  • @h2CO3 i have had this before, if you start editing while another person is, it will revert who evers changes happened first, because while you are editing, the new changes dont come through for the person submitting edits second. since your edits were ~1 min apart this is most likely what happened – Fonix Mar 28 '13 at 08:01
  • @Fonix That's definitely possible. Should I file a bug on Meta? All this shall not be happening, false evidence is wrong. –  Mar 28 '13 at 08:02
  • So does the following code accessing nested dictionaries? [error.userInfo[FBErrorParsedJSONResponseKey][@"body"][@"error"][@"type"] isEqualToString:@"OAuthException"] – bilalm Mar 29 '13 at 03:55

0 Answers0