How to publish a music file (mp3) on facebook

I am developing an application that requires me to publish an audio file to my facebook account. I publish it through FBStream and in

NSString *str = @"{'media': [{
    'type': 'music', 
    'src': 'http://www.looptvandfilm.com/blog/Radiohead%20-%20In%20Rainbows/01%20-%20Radiohead%20-%2015%20Step.MP3', 
    'title': '15 Step', 
    'artist': 'Radiohead', 
    'album': 'In Rainbows'
}]}";

NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: str, @"attachment" ,nil,@"message",nil];


    [[FBRequest requestWithDelegate:self] call:@"facebook.stream.publish" params:params];

I can post / post my images and videos to facebook using the same template, but when I try to use this code, it shows that “music type is not supported”. I got this string value: http://developers.facebook.com/docs/guides/attachments .

Please help me out of it.

+3
source share
1 answer

You can publish it using this string format (str),

NSString *str = @"{'media': [{
    'type': 'mp3', 
    'src': 'http://www.looptvandfilm.com/blog/Radiohead%20-%20In%20Rainbows/01%20-%20Radiohead%20-%2015%20Step.MP3', 
    'title': '15 Step', 
    'artist': 'Radiohead', 
    'album': 'In Rainbows'
}]}";
+1
source

Source: https://habr.com/ru/post/1779350/


All Articles