• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ios Facebook Graph API - 发布音频文件

[复制链接]
菜鸟教程小白 发表于 2022-12-13 10:00:00 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我在 iOS 中使用 FB Graph API 在用户的墙上发帖。我想附上托管在其他地方的音频文件。由于“附件”似乎不再有效,我正在尝试将 og:audio 作为属性:

    SBJSON *jsonWriter = [[SBJSON new] autorelease];

    NSString *fileURL = [NSString stringWithFormat"http://site-addr.com/%@", @"tst.mp3"];

    NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys:
                                fileURL, @"og:audio",
                                strText, @"og:audio:title", 
                                nil];

    NSString *propStr = [jsonWriter stringWithObject:properties];


    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   @"message Text",@"message",
                                   @"Martha",@"name",
                                   @"http://addr/something.jpg", @"picture",
                                   propStr, @"properties",
                                   nil];          

[facebook requestWithGraphPath"me/feed" andParams:params andHttpMethod"OST" andDelegate:self];

不知何故,我得到的只是“og:audio”....作为帖子中的文本。 我想知道如何将音频文件作为播放器发布到帖子中。



Best Answer-推荐答案


-(void)postMeFeedButtonPressed{

    NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:4];

    [variables setObject"Sharing Audio" forKey"message"];
    [variables setObject:[NSString stringWithFormat"Audio from xyz" forKey"name"];
    [variables setObject"Audio URL here.mp3" forKey"source"];



    FbGraphResponse *fb_graph_response = [fbGraph doGraphPost"me/feed" withPostVars:variables];
    NSLog(@"postMeFeedButtonPressed:  %@", fb_graph_response.htmlResponse);


    //parse our json
    SBJSON *parser = [[SBJSON alloc] init];
    NSDictionary *facebook_response = [parser objectWithString:fb_graph_response.htmlResponse error:nil];   
    [parser release];

    //let's save the 'id' Facebook gives us so we can delete it if the user presses the 'delete /me/feed button'
    self.feedPostId = (NSString *)[facebook_response objectForKey:@"id"];
    NSLog(@"feedPostId, %@", feedPostId);
    NSLog(@"Now log into Facebook and look at your profile...");

}

这将在嵌入式播放器中呈现音频内容。 希望它对某人有帮助。 谢谢

关于ios Facebook Graph API - 发布音频文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8301118/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap