Oli*_*lie 4 iphone facebook ios
我有一些代码可以进行一些设置,然后使用FB-connect发布到Facebook.有一次,我有这样的事情:
NSString *description =
@"Wow, what a great app! "
@"Download it free: "
@"<a href=\"http://itunes.apple.com/us/app/myApp/id12345?mt=8\">"
@"On iTunes AppStore."
@"</a>"
;
// post FB dialog
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
// @"This is what I say about myApp:", @"message", // user msg
@"MyApp!", @"name", // Bold/blue name
@"MyApp is cool!", @"caption", // 1st line
description, @"description", // 2nd line
@"http://itunes.apple.com/us/app/myApp/id12345?mt=8", @"link",
@"http://farm6.static.flickr.com/5230/5576336654_075c2abcf9_s.jpg", @"picture",
nil];
[facebook dialog: @"feed"
andParams: params
andDelegate: self];
Run Code Online (Sandbox Code Playgroud)
它几乎可以工作!唯一的问题是:在我的描述字符串中," <a href..."和" </a>" 之间的所有内容都不会显示在我的Facebook墙上.
所以问题是:如何在帖子中添加链接(锚标签样式)?
fla*_*ill 14
无法在说明中添加链接,但是您可以使用"属性"和"操作"键获得相同的结果,如下所示:
代码如下:
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary *propertyvalue = [NSDictionary dictionaryWithObjectsAndKeys:@"On iTunes AppStore", @"text", @"http://itunes.apple.com/us/app/myApp/id12345?mt=8", @"href", nil];
NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys:propertyvalue, @"Download it free:", nil];
NSDictionary *actions = [NSDictionary dictionaryWithObjectsAndKeys:@"Download it free", @"name",@"http://itunes.apple.com/us/app/myApp/id12345?mt=8", @"link", nil];
NSString *finalproperties = [jsonWriter stringWithObject:properties];
NSString *finalactions = [jsonWriter stringWithObject:actions];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
userfbid, @"to",
@"http://itunes.apple.com/us/app/myApp/id12345?mt=8", @"link",
@"http://farm6.static.flickr.com/5230/5576336654_075c2abcf9_s.jpg", @"picture",
@"Name name name", @"name",
@"Caption caption caption", @"caption",
@"Description description description", @"description",
finalproperties, @"properties",
finalactions, @"actions",
nil];
[_facebook dialog:@"feed" andParams:params andDelegate:self];
Run Code Online (Sandbox Code Playgroud)
属性将显示在描述下方的流附件中,每个属性都在其自己的行上.这些操作将显示在帖子下的"评论"和"赞"链接旁边.
在附带的屏幕截图中,您将看到属性和操作的外观.第一个屏幕截图显示了iPhone上弹出对话框时的外观.第二个屏幕截图显示了带有属性对象的Facebook帖子.第三个屏幕截图显示了包含属性和操作对象的Facebook帖子.

希望这可以帮助.
| 归档时间: |
|
| 查看次数: |
5155 次 |
| 最近记录: |