我使用开放图形故事将新的Facebook SDK实现到我的应用程序中。过程:
错误: 有时(大约1/6)在共享对话框启动后的第2步之后,它会随着错误而消失
Error Failed to generate preview for user.
打开图表:
final String fbNamespace = "myns";
// Create an object
ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
.putString("og:type", fbNamespace + ":badge")
.putString("og:description", "Some description")
.putString("og:title", "I've just unlocked a new badge!")
.putString("og:url", "http://website.net")
.putString("og:image", url)
.build();
// Create an action
ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
.setActionType(fbNamespace + ":unlock")
.putObject("badge", object)
.build();
// Create the content
ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
.setPreviewPropertyName("badge")
.setAction(action)
.build();
ShareDialog.show(MainActivity.this, content);
回调:
shareDialog = new ShareDialog(this);
shareDialog.registerCallback(mCallbackManager, new FacebookCallback<Sharer.Result>() {
@Override
public void onSuccess(Sharer.Result result) {
Log.i("Share", "Success");
}
@Override
public void onCancel() {
Log.i("Share", "Cancel");
}
@Override
public void onError(FacebookException error) {
Log.i("Share", "Error" + error.toString()); //Failed to generate preview for user
}
});
同样奇怪的是,当ShareDialog
与预设图像,标题和描述一起显示时,故事出现大约需要3秒钟。 (这种情况每次都会发生)
注意:还有其他问题正在寻找相同错误消息的解决方案,但在这些情况下,对话框在显示后总是会消失。
答案 0 :(得分:0)
在代码中添加命名空间:
<?php $user_query=mysql_query("select * from users")or die(mysql_error());
while($row=mysql_fetch_array($user_query)){
$id=$row['user_id']; ?>
<tr class="del<?php echo $id ?>">
<td><?php echo $row['username']; ?></td>
<td><?php echo $row['password']; ?></td>
<td><?php echo $row['givenname']; ?></td>
<td><?php echo $row['surname']; ?></td>
<td width="100">
<a rel="tooltip" title="Delete" id="<?php echo $id; ?>" href="#delete_user<?php echo $id; ?>" data-toggle="modal" class="btn btn-danger"><i class="icon-trash icon-large"></i></a>
<?php include('delete_user_modal.php'); ?>
<a rel="tooltip" title="Edit" id="e<?php echo $id; ?>" href="#edit<?php echo $id; ?>" data-toggle="modal" class="btn btn-success"><i class="icon-pencil icon-large"></i></a>
<?php include('modal_edit_user.php'); ?>
</td>
<?php include('toolttip_edit_delete.php'); ?>