我和圖:在地獄裏做的組合。 考慮以下幾點:FB圖訂閱iOS
爲了建立一個FB訂閱我有這樣的方法:
-(void)subscribeToFacebook{
(FBSession.activeSession.isOpen) ? NSLog(@"is open") : NSLog(@"is closed");
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
@"page", @"object",
@"http://www.example.com/fbcallback.php", @"callback_url",
@"about, picture", @"fields",
@"ItsMeAlright", @"verify_token",
nil
];
/* make the API call */
[FBRequestConnection startWithGraphPath:@"/{app-id}/subscriptions"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
/* handle the result */
NSLog(@"error= %@",error);
}];
}
,我幾乎從字面上FB手動複製。
在http://www.example.com/fbcallback.php我有這樣的代碼:
<?php
$hub_mode = $_GET['hub_mode'];
$hub_challenge = $_GET['hub_challenge'];
$hub_verify_token = $_GET['hub_verify_token'];
if ($hub_verify_token =='ItsMeAlright')
{
echo $hub_challenge;
}
//and here i am planning to add some logic.
?>
不幸的是,iOS的運行我的方法,它記錄了以下錯誤:
Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x7e921970 {com.facebook.sdk:ErrorInnerErrorKey=Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo=0x7d7a21a0 {NSUnderlyingError=0x7d4388c0 "unsupported URL", NSLocalizedDescription=unsupported URL}, com.facebook.sdk:HTTPStatusCode=200, com.facebook.sdk:ErrorSessionKey=, expirationDate: 2015-04-07 09:12:48 +0000, refreshDate: 2015-02-07 08:57:41 +0000, attemptedRefreshDate: 0000-12-30 00:00:00 +0000, permissions:( "public_profile", email, "user_friends")>}
那是什麼一回事呢?該錯誤實際上表明,這是一個iOS的東西。我很困惑。希望你不是。
還是應該用我的應用程序ID替換「{app-id}」? – Sjakelien 2015-02-07 09:27:19
這個問題太簡單了嗎?或者你們和加爾實際上慶祝了這個週末? – Sjakelien 2015-02-07 10:26:02
是的,您需要將其替換爲您的應用ID – Wain 2015-02-07 10:31:05