如何在使用消息时为UIActivityViewController设置收件人

时间:2017-01-09 14:29:38

标签: ios swift uiactivityviewcontroller

我正在使用此代码来呈现UIActivityViewController。

 var a = standard.value(forKey: "first_name") as? String
    let text = a! + " text to share"
    let url : NSURL = NSURL(fileURLWithPath: "https://itunes.apple.com/in/app/")

    let textToShare = [ text as String , url as URL ] as [Any]
    let activityViewController = UIActivityViewController(activityItems: textToShare, applicationActivities: nil)


    activityViewController.popoverPresentationController?.sourceView = self.view // so that iPads won't crash
    activityViewController.completionWithItemsHandler = {
        (s, ok, items, error) in
        if ok == true {
            DispatchQueue.main.async {
               // code after completion
            }

        }
    }
    self.present(activityViewController, animated: true, completion: nil)

但我想要的是,如果我在UIActivityViewController中选择了消息选项,那么电话号码应该预先填写我提供的号码。是否可以使用UIActivityViewController。如果是,请向我提供一些参考或代码

0 个答案:

没有答案