Skip to content

Commit

Permalink
iOS SDK: fix a few issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Yujuan Bao committed Sep 13, 2010
1 parent 09c5083 commit fcd2400
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion sample/theRunAround/Classes/Session.m
Expand Up @@ -55,7 +55,7 @@ - (void) save {
if ((access_token != (NSString *) [NSNull null]) && (access_token.length > 0)) {
[defaults setObject:access_token forKey:@"FBAccessToken"];
} else {
[defaults removeObjectForKey:@"FBSessionKey"];
[defaults removeObjectForKey:@"FBAccessToken"];
}

NSDate *expirationDate = _facebook.expirationDate;
Expand Down
9 changes: 5 additions & 4 deletions src/FBDialog.m
Expand Up @@ -462,6 +462,9 @@ - (void)deviceOrientationDidChange:(void*)object {
// UIKeyboardNotifications

- (void)keyboardWillShow:(NSNotification*)notification {

_showingKeyboard = YES;

if (FBIsDeviceIPad()) {
// On the iPad the screen is large enough that we don't need to
// resize the dialog to accomodate the keyboard popping up
Expand All @@ -474,11 +477,11 @@ - (void)keyboardWillShow:(NSNotification*)notification {
-(kPadding + kBorderWidth),
-(kPadding + kBorderWidth) - _titleLabel.frame.size.height);
}

_showingKeyboard = YES;
}

- (void)keyboardWillHide:(NSNotification*)notification {
_showingKeyboard = NO;

if (FBIsDeviceIPad()) {
return;
}
Expand All @@ -488,8 +491,6 @@ - (void)keyboardWillHide:(NSNotification*)notification {
kPadding + kBorderWidth,
kPadding + kBorderWidth + _titleLabel.frame.size.height);
}

_showingKeyboard = NO;
}

//////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
28 changes: 19 additions & 9 deletions src/FBRequest.m
Expand Up @@ -175,10 +175,12 @@ - (id)parseJsonResponse:(NSData*)data error:(NSError**)error {
if ([responseString isEqualToString:@"true"]) {
return [NSDictionary dictionaryWithObject:@"true" forKey:@"result"];
} else if ([responseString isEqualToString:@"false"]) {
*error = [self formError:kGeneralErrorCode
userInfo:[NSDictionary
dictionaryWithObject:@"This operation can not be completed"
forKey:@"error_msg"]];
if (error != nil) {
*error = [self formError:kGeneralErrorCode
userInfo:[NSDictionary
dictionaryWithObject:@"This operation can not be completed"
forKey:@"error_msg"]];
}
return nil;
}

Expand All @@ -187,22 +189,30 @@ - (id)parseJsonResponse:(NSData*)data error:(NSError**)error {

if (![result isKindOfClass:[NSArray class]]) {
if ([result objectForKey:@"error"] != nil) {
*error = [self formError:kGeneralErrorCode
userInfo:result];
if (error != nil) {
*error = [self formError:kGeneralErrorCode
userInfo:result];
}
return nil;
}

if ([result objectForKey:@"error_code"] != nil) {
*error = [self formError:[[result objectForKey:@"error_code"] intValue] userInfo:result];
if (error != nil) {
*error = [self formError:[[result objectForKey:@"error_code"] intValue] userInfo:result];
}
return nil;
}

if ([result objectForKey:@"error_msg"] != nil) {
*error = [self formError:kGeneralErrorCode userInfo:result];
if (error != nil) {
*error = [self formError:kGeneralErrorCode userInfo:result];
}
}

if ([result objectForKey:@"error_reason"] != nil) {
*error = [self formError:kGeneralErrorCode userInfo:result];
if (error != nil) {
*error = [self formError:kGeneralErrorCode userInfo:result];
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/UnitTest/Classes/UnitTestViewController.m
Expand Up @@ -194,7 +194,7 @@ - (void) testAuthenticatedApi {
dateString = [formatter stringFromDate:[NSDate date]];
[formatter release];
NSString *msg = @"Hello World";
msg = [msg stringByAppendingFormat:dateString];
msg = [msg stringByAppendingString:dateString];

NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
msg, @"message",
Expand All @@ -216,7 +216,7 @@ - (void) testApiError {
dateString = [formatter stringFromDate:[NSDate date]];
[formatter release];
NSString *msg = @"Hi World";
msg = [msg stringByAppendingFormat:dateString];
msg = [msg stringByAppendingString:dateString];

NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
msg, @"message",
Expand Down

0 comments on commit fcd2400

Please sign in to comment.