2011-11-28 3 views
2

사용자의 벽에 게시하기 위해 iOS에서 FB Graph API를 사용하고 있습니다. 다른 곳에서 호스팅되는 오디오 파일을 첨부하고 싶습니다. 속성으로 오디오 : "첨부 파일"더 이상 유효하지 않은 것, 나는이 자책골을 시도하고 게시물에 텍스트로 .... :ios Facebook Graph API - 게시 오디오 파일

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"입니다. 오디오 파일을 플레이어로 게시하는 방법을 궁금합니다.

답변

3
-(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..."); 

} 

이것은 내장 된 플레이어의 오디오 콘텐츠를 제공합니다. 누군가에게 도움이되기를 바랍니다. 감사합니다

+0

안녕하세요 저는이 코드를 사용하지만 임베디드 플레이어가 작동하지 않습니다. 내 오디오 파일 URL은 http://bit.ly/Ok4ZX6입니다. . . 그리고 그것은 http://i.stack.imgur.com/Ld67c.png와 같은 페이스 북에서 보여줍니다. –