我曾经有一种将Spotify歌曲完美地发布到Facebook的工作方式。
它们看起来就像从 mac 或 windows 版本的 spotify 共享的任何其他链接。
现在,几个月后..我只能发布像 www.domain.com 这样的链接,但我不能再发布像http://open.spotify.com/track/4yLSpYlcO0jPPLTa3nW8zN这样的链接
有人可以尝试发布一个类似上面的链接,看看它是否在他们的 Facebook 上显示为带有专辑封面的播放图标吗?我想知道 facebook 是否已经改变了他们的 API,所以这不再可能了?我正在使用 FBGraph。
结果应该是这样的(就像之前一样):
http://voteplay.no/fbspotify.png
但是,现在我在使用 spotify url 时收到此错误:
抱歉,出了一些问题。我们正在尽快努力修复这个。
更新
代码:
- (IBAction)facebookShare:(id)sender {
PartyQAppDelegate *delegate = (PartyQAppDelegate *)[[UIApplication sharedApplication] delegate];
facebook = [delegate facebook];
if (![facebook isSessionValid]) {
facebook.sessionDelegate = delegate;
NSArray *permissions = [[NSArray alloc] initWithObjects:@"read_stream", @"publish_stream",@"offline_access", nil];
[facebook authorize:permissions];
NSLog(@"SESSION NOT VALID!");
}else {
NSLog(@"SESSION VALID!");
NSString *trackurl = [self openSpotifyEncode:self.currentTrackPlaying];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:trackurl, @"link",nil];
[facebook dialog:@"feed" andParams:params andDelegate:self];
}
}
- (NSString *)openSpotifyEncode:(NSString *)string {
NSString *encodedString = [NSString stringWithFormat:@"http://open.spotify.com/track/%@", [string substringFromIndex:14]];
return encodedString;
}
我已经解决了错误,不再需要任何帮助!感谢您让我知道它仍在工作。(努力寻找错误)。
错误是 appdelegate 中的代码顺序,但我仍然不知道为什么这会让我完美地发布所有其他链接而不是 spotify 链接。