使用Facebook美味的应用程序示例代码

时间:2012-09-11 11:41:18

标签: objective-c ios facebook facebook-graph-api

我正在尝试使用Facebook Scrumptious应用示例代码中的代码。我对“您的OG对象将包含您的服务器托管的URL”感到困惑。评论。这是否意味着我必须在服务器上加载脚本?如果是这样,什么剧本?另外,“repeater.php”文件。这是什么?

有没有其他人必须配置这个并且能指出我正确的方向?谢谢你的帮助。

    - (id<SCOGMeal>)mealObjectForMeal:(NSString*)meal 
{
    // This URL is specific to this sample, and can be used to
    // create arbitrary OG objects for this app; your OG objects
    // will have URLs hosted by your server.
    NSString *format =  
        @"https://<YOUR_BACK_END>/repeater.php?"
        @"fb:app_id=<YOUR_APP_ID>&og:type=%@&"
        @"og:title=%@&og:description=%%22%@%%22&"
        @"og:image=https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png&"
        @"body=%@";

    // We create an FBGraphObject object, but we can treat it as 
    // an SCOGMeal with typed properties, etc. See <FacebookSDK/FBGraphObject.h> 
    // for more details.
    id<SCOGMeal> result = (id<SCOGMeal>)[FBGraphObject graphObject];

    // Give it a URL that will echo back the name of the meal as its title, 
    // description, and body.
    result.url = [NSString stringWithFormat:format, 
                   @"<YOUR_APP_NAMESPACE>:meal", meal, meal, meal];

    return result;
}

1 个答案:

答案 0 :(得分:2)

请参阅教程中的Step 2 - Set Up Your Backend Server。它包含一个示例脚本和对repeater.php的引用。您问题中的代码会显示在第7步的页面下方。