SLComposeViewController SLServiceTypeFacebook在iOS 9.1中不起作用

时间:2016-06-10 07:52:17

标签: ios facebook

我有以下代码:

Post

我试过了&gt; iOS版本8.x,但是,我只在iOS 9.1上找到,public PieChartPanel() { this.setLayout(new BorderLayout()); add(new JScrollPane(getJfxPanel()), BorderLayout.CENTER); } public JFXPanel getJfxPanel() { if (jfxPanel == null) { jfxPanel = new JFXPanel(); jfxPanel.setScene(getScene()); } return jfxPanel; } public Scene getScene() { if (scene == null) { Group root = new Group(); scene = new Scene(root, Color.ALICEBLUE); javafx.scene.control.ScrollPane scroll = new ScrollPane(); scroll.setFitToHeight(true); scroll.setFitToWidth(true); scroll.setContent(getPieChart()); root.getChildren().addAll(scroll); } return scene; } private PieChart getPieChart() { if (pieChart == null) { ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList(); pieChart = new PieChart(pieChartData); pieChart.setTitle("Toplam Talep (Ünite) Grafiği"); pieChart.setLabelLineLength(20); pieChart.setLegendSide(Side.RIGHT); pieChart.setClockwise(true); } return pieChart; } 按钮是灰色的,文本字段是空的,而在较新的iOS版本9.3.1中不是。

有人有想法吗?我怀疑是因为:

  

插件com.apple.share.Facebook.post无效

引导我link并发现Facebook的政策不允许预先填写的文字,但是为什么在iOS 9.3.1中有效。

更新: 在文本字段中键入一些文本后,再次启用“发布”按钮。

1 个答案:

答案 0 :(得分:-1)

试试此代码

if SLComposeViewController.isAvailableForServiceType(SLServiceTypeFacebook)
{
    let twitterComposeVC = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
    twitterComposeVC.setInitialText(messagge)
    twitterComposeVC.addURL(NSURL.init(string: url))

    fromController.presentViewController(twitterComposeVC, animated: true, completion: nil)
}
else
{
    print("No twitter account is configured in settings.");
}