是否可以预先填写Facebook共享标题,因为似乎某些应用程序预先填充了它们?

时间:2015-09-24 12:40:56

标签: ios facebook share

根据Facebook分享政策,不允许预先填写? https://developers.facebook.com/docs/apps/review/prefill

我最近尝试过InstaWeather和Flickr iOS应用程序,他们预先填写了标题。他们真的被允许了吗?

有人可以澄清一下吗?

2 个答案:

答案 0 :(得分:1)

根据FB Dev社区的讨论(FB家伙自己提到),显然不允许这样做。提到这些应用程序,无论是谁,都明显违反。

https://www.facebook.com/groups/fbdevelopers/961186750591506

答案 1 :(得分:0)

您可以使用自定义对象/动作/故事来完成此操作。 Bellow是我的应用程序的FB共享代码的一部分。您可以在FB https://www.facebook.com/aklobanov

的Feed中查看此应用中的帖子
    NSURL *appUrl = [[NSURL alloc] initWithScheme:FB_APP_LINK_SCHEME host:FB_APP_LINK_HOST path:FB_APP_LINK];
    NSDictionary *objectProperties = @{
                                       @"og:type": @"protrackreader:jump",
                                       @"og:title": [NSString stringWithFormat:NSLocalizedString(@"F1", nil), [[self->jump number] stringValue], [[self->jump date] longDate]],
                                       @"og:rich_attachment": @"true",
                                       @"protrackreader:serial":[[self->jump altimeter] serial],
                                       @"protrackreader:freefall:value": [[self->jump freefall] stringValue],
                                       @"protrackreader:freefall:units": @"s",
                                       @"protrackreader:altitude_exit:value": [[self->jump exit] stringValue],
                                       @"protrackreader:altitude_exit:units": @"ft",
                                       @"protrackreader:altitude_open:value": [[self->jump open] stringValue],
                                       @"protrackreader:altitude_open:units": @"ft"
                                       };
    FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:objectProperties];
    if (object != nil)
    {
        [object setURL:appUrl forKey:@"og:url"];
        UIImage *image = nil;
        if ([self->jump profile] != nil)
        {
            ProfileGraph *graph = nil;
            graph = [[ProfileGraph alloc] initWithDataObject:[self->jump profile]];
            if (graph != nil)
            {
                graph.speedMeasureValue = self->speedMeasureValue;
                graph.altitudeMeasureValue = self->altitudeMeasureValue;
                graph.speedMeasureText = self->speedMeasureText;
                graph.altitudeMeasureText = self->altitudeMeasureText;
                graph.themeName = kCPTSlateTheme;
                image = [graph renderGraphInImageWithRectangle:CGRectMake(0.0, 0.0, FB_IMAGE_WIDTH, FB_IMAGE_HEIGHT)];
                graph = nil;
            }
        }
        else
        {
            image = [UIImage imageNamed:@"protrack_reader_app"];
        }
        if (image != nil)
        {
            FBSDKSharePhoto *photo = [FBSDKSharePhoto photoWithImage:image userGenerated:NO];
            if (photo != nil) [object setPhoto:photo forKey:@"og:image"];
        }
        FBSDKShareOpenGraphAction *action = [FBSDKShareOpenGraphAction actionWithType:@"protrackreader:share" object:object key:@"protrackreader:jump"];
        if (action != nil)
        {
            [action setString:@"false" forKey:@"no_feed_story"];
            [action setString:@"true" forKey:@"fb:explicitly_shared"];
            FBSDKShareOpenGraphContent *content = [FBSDKShareOpenGraphContent new];
            if (content != nil)
            {
                content.previewPropertyName = @"protrackreader:jump";
                content.action = action;
                content.contentURL = appUrl;
                FBSDKShareAPI *api = [FBSDKShareAPI new];
                if (api != nil)
                {
                    api.shareContent = content;
                    api.delegate = self;
                    api.shouldFailOnDataError = YES;
                    error = nil;
                    if (![api validateWithError:&error])
                    {
                        [error reportError];
                    }
                    else
                    {
                        if ([api canShare])
                        {
                            if (self->hud != nil) self->hud = nil;
                            self->hud = [[MBProgressHUD alloc] initWithView:self.view];
                            self->hud.removeFromSuperViewOnHide = YES;
                            [self.view addSubview:self->hud];
                            self->hud.labelText = NSLocalizedString(@"H9",nil);
                            [self->hud show:YES];
                            return [api share];
                        }
                    }
                }
            }
        }
    }