【问题标题】:How do I get my application to show up in the add people on ios notes menu如何让我的应用程序显示在 ios 注释菜单上的添加人员中
【发布时间】:2017-02-27 06:48:57
【问题描述】:

iOS 笔记的分享功能。 Link.

我看到 iOS 笔记协作的一项功能。 想要在共享中打开我的应用程序联系人并允许访问我的应用程序的联系人。

哪个UTIs 在这里有用?我阅读了它的完整列表,但不确定,是链接、数据还是其他?

现在,当任何用户单击添加人员时,我如何让我的应用程序显示?

如何做到这一点?

【问题讨论】:

  • 我不确定,看看share extension 可能会有帮助。
  • @Gokul 现在它显示在菜单中,但我无法与我的应用程序的联系人分享,比如什么应用程序!!
  • 现在它显示了共享扩展,但无法像 WhatsApp 一样共享文本! 从共享菜单中单击应用图标,而不是重定向以打开我的应用,它只是打开一个帖子对话框,之后就什么都没有了..

标签: ios iphone swift ios10 uti


【解决方案1】:

很高兴听到 Share extrension 有效,

  • 打开的分享对话框是来自SLComposeServiceViewController的默认对话框,记录为

    SLComposeServiceViewController 类提供了一个standard compose view,您可以在两个平台上为社交分享扩展提供一个standard compose view

  • To UIViewControllerSLComposeServiceViewController 的直接父级,因此您可以根据需要自定义共享对话。

  • 因此,只需将类的继承更改为 UIViewController 的继承,并删除所有 SLComposeServiceViewController 特定的方法。使用 UITableView 列出您在 ShareViewController.swift 中的所有联系人列表

  • 查看this 以供参考。下图是我的演示分享对话。

编辑:添加我的ShareViewController.swift 代码供您参考

    import UIKit
    import Social

    class ShareViewController: UIViewController,UITableViewDataSource {

      @IBOutlet var languageTable: UITableView!

      var languageList = ["Swift","Python","Java","ObjC",".Net","php"]


      override func viewDidLoad() {
        languageTable.dataSource = self
        languageTable.reloadData()
      }

      func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
      }

      func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return languageList.count
      }

     func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
       let cell:UITableViewCell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath)
       cell.textLabel?.text = languageList[indexPath.row]
       return cell
     }

    }

【讨论】:

  • 我已经使用了 Action Extension。
  • 听起来不错,如果你有时间检查这个解决方案。它可以帮助其他人
猜你喜欢
  • 2017-11-29
  • 2017-12-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-12-08
相关资源
最近更新 更多