简体   繁体   English

libgdx和robovm,打开Facebook共享对话框

[英]libgdx and robovm, opening the facebook share dialog

Does anyone have a working example of using robovm(and facebook robopods i assume) to open the facebook share dialog on IOS? 有没有人有使用robovm(我假设是facebook robopods)在IOS上打开Facebook共享对话框的有效示例? I have tried every solution I can find with no success :( All solutions use something along the line of: 我尝试了所有无法找到的解决方案:(所有解决方案都使用以下方法:

 dialog = new FBSDKShareDialog();
 dialog.setFromViewController(getWindow().getRootViewController());
 dialog.setShareContent(content);
 dialog.show();

But it always crashes at the dialog.show part. 但是它总是在dialog.show部分崩溃。

The show method can only be called in the main queue (I believe it is the same as the ui thread). show方法只能在主队列中调用(我相信它与ui线程相同)。 You can force it there using the following example: 您可以使用以下示例将其强制放置在那里:

final FBSDKShareDialog dialog = new FBSDKShareDialog();
dialog.setShareContent(content);
dialog.setFromViewController(application.getRootApplication().getUIViewController());


NSOperationQueue.getMainQueue().addOperation(new Runnable() {
    @Override
    public void run() {
        if (dialog.canShow())
            dialog.show();
        //else
        //    fallback();
    }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM