I implemented the Add Friend dialog on iPhone using the post on stackoverflow:
Facebook friends dialog returns "Unknown method" error, it's implemented for Android but easy to convert to iPhone.
It worked fine until a few days ago when it stopped working and now it's throwing me an error:
An error occurred with HitMe. Please try again later.
API Error Code: 3
API Error Description: Unknown method
Error Message: This method isn't supported for this display type
I tried to search in facebook roadmap: https://developers.facebook.com/roadmap/ but couldn't find any mentioning of the change, did anyone experience this issue or know another way to implement the "Friend Request" dialog on iPhone?
This is the changes I made to the Facebook 2.0 sdk to implement the "Friend Request" dialog:
in dialog:andParams:andDelegate: method in Facebook.m I replaced the original code by the following code:
-(void)dialog:(NSString *)action
andParams:(NSMutableDictionary *)params
andDelegate:(id <FBDialogDelegate>)delegate {
[_fbDialog release];
NSString *dialogURL;
if ([action isEqualToString:kFriends])
{
dialogURL = [kDialogBaseURLForFriends stringByAppendingString:action];
}
else
{
dialogURL = [kDialogBaseURL stringByAppendingString:action];
}
if ([action isEqualToString:kFriends])
{
[params setObject:@"popup" forKey:@"display"];
}
else
{
[params setObject:@"touch" forKey:@"display"];
}
[params setObject:kSDKVersion forKey:@"sdk"];
[params setObject:kRedirectURL forKey:@"redirect_uri"];
if ([action isEqualToString:kLogin]) {
[params setObject:@"user_agent" forKey:@"type"];
_fbDialog = [[FBLoginDialog alloc] initWithURL:dialogURL loginParams:params delegate:self];
} else {
[params setObject:_appId forKey:@"app_id"];
if ([self isSessionValid]) {
[params setValue:[self.accessToken stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
forKey:@"access_token"];
[self extendAccessTokenIfNeeded];
}
// by default we show dialogs, frictionless cases may have a hidden view
BOOL invisible = NO;
// frictionless handling for application requests
if ([action isEqualToString:kApprequests]) {
// if frictionless requests are enabled
if (self.isFrictionlessRequestsEnabled) {
// 1. show the "Don't show this again for these friends" checkbox
// 2. if the developer is sending a targeted request, then skip the loading screen
[params setValue:@"1" forKey:@"frictionless"];
// 3. request the frictionless recipient list encoded in the success url
[params setValue:@"1" forKey:@"get_frictionless_recipients"];
}
// set invisible if all recipients are enabled for frictionless requests
id fbid = [params objectForKey:@"to"];
if (fbid != nil) {
// if value parses as a json array expression get the list that way
SBJsonParser *parser = [[[SBJsonParser alloc] init] autorelease];
id fbids = [parser objectWithString:fbid];
if (![fbids isKindOfClass:[NSArray class]]) {
// otherwise seperate by commas (handles the singleton case too)
fbids = [fbid componentsSeparatedByString:@","];
}
invisible = [self isFrictionlessEnabledForRecipients:fbids];
}
}
_fbDialog = [[FBDialog alloc] initWithURL:dialogURL
params:params
isViewInvisible:invisible
frictionlessSettings:_frictionlessRequestSettings
delegate:delegate];
}
[_fbDialog show];
}
where kFriends is @"friends" and kDialogBaseURLForFriends is @"https://facebook.com/dialog/"