ios Facebook图形API-发布音频文件
我正在使用iOS中的FB Graph API在用户墙上发布。我想附加一个托管在其他地方的音频文件。由于“附件”似乎不再有效,我尝试将og:audio作为属性:ios Facebook图形API-发布音频文件,ios,facebook,facebook-graph-api,audio,Ios,Facebook,Facebook Graph Api,Audio,我正在使用iOS中的FB Graph API在用户墙上发布。我想附加一个托管在其他地方的音频文件。由于“附件”似乎不再有效,我尝试将og:audio作为属性: SBJSON *jsonWriter = [[SBJSON new] autorelease]; NSString *fileURL = [NSString stringWithFormat:@"http://site-addr.com/%@", @"tst.mp3"]; NSDictionary *prope
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:@"POST" andDelegate:self];
不知怎的,我得到的只是“og:audio”。。。。作为文本输入到帖子中。
我想知道如何将音频文件作为播放器发布到post中
-(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...");
}
这将在嵌入式播放器中显示音频内容。
希望这对某人有帮助。
谢谢您好,我已经使用了此代码,但嵌入式播放器无法工作。我的音频文件URL是。它在facebook上的表现是这样的