我實現了添加朋友對話框在iPhone上使用上的帖子在stackoverflow上:
Facebook friends dialog returns "Unknown method" error,它實現了Android,但易於轉換爲iPhone。Facebook的朋友請求對話框停止工作在UIWebView
它能正常工作,直到前幾天,當它停止工作,現在它扔我一個錯誤:與HitMe發生
錯誤。請稍後再試。
API錯誤代碼:3
API錯誤說明:未知的方法
錯誤消息:不支持此方法對於這款顯示器類型
我試圖在Facebook的路線圖搜索:https://developers.facebook.com/roadmap/,但找不到任何提的變化,有沒有人遇到過這個問題,或知道另一種方式來實現iPhone上的「朋友請求」對話框?
這是我給Facebook的2.0 SDK所做的修改實行的「好友請求」對話框:
在對話框:andParams:andDelegate:方法在Facebook.m我替換如下代碼的原代碼:
-(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];
}
其中kFriends是@ 「朋友」 和kDialogBaseURLForFriends是@ 「https://facebook.com/dialog/」
看來,再次開始工作,但現在要求我登錄,無論我添加到請求參數的有效訪問令牌,你有任何想法如何處理? –