2011-12-11 58 views
0

几个月前,我曾经可以用我自己的文本预先填充对话框,所以用户只需点击共享即可分享该文本,但似乎Facebook已经开始忽略像他们说的那样的参数这篇文章:https://developers.facebook.com/blog/post/510/预填充对话框使用FBConnect?

所以有没有其他解决方法,所以我可以预先填写消息,用户可以轻松地共享?

谢谢!

- (void)webViewDidFinishLoad:(UIWebView *)webView 
{ 
    [super webViewDidFinishLoad:webView]; 

    if (defaultStatus) 
    { 
     // Set the pre-filled status message 
     [_webView stringByEvaluatingJavaScriptFromString: 
     [NSString stringWithFormat:@"document.getElementsByName('feedform_user_message')[0].value = decodeURIComponent('%@')", 
      [SHKEncode(defaultStatus) stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"] 
     ] 
     ]; 

     // Make the text field bigger 
     [_webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByName('feedform_user_message')[0].style.height='100px'"]; 
    } 
} 

回答

1

afaik无法再用javascript api预填充消息框,这是件好事。毕竟这是对平台政策:

https://developers.facebook.com/docs/guides/policy/application_integration_points/

但是:它应该还是有可能用PHP API/SDK。您只需允许用户在发送消息之前编辑消息,并使用textarea或输入字段。只需使用消息参数向/ me/feed发送帖子即可。

+0

那么没有其他方法可以做到这一点?如果我的应用程序严重依赖于此呢? –

+0

你可以展示一些示例代码,让我走上正确的轨道吗?然后我会投票并接受你的答案! :) –

+0

检查我的代码上面,该代码目前不工作,但我将如何修改它,所以它的工作? –