在iOS swift中通过电子邮件或短信分享后崩溃

时间:2016-06-17 13:47:24

标签: ios objective-c swift uiview uiviewcontroller

我想分享一些内容。发送电子邮件或短信后,我的应用程序崩溃了。收到的电子邮件和短信。它适用于所有其他类型。 我添加了社交框架并将Social导入到该类

我的代码:

    if let myWebsite = NSURL(string: "http://www.mstcode.com")
    {
        let messageStr = "Learn how to build iPhone apps"
        let shareItems = [messageStr, myWebsite]
        let activityController = UIActivityViewController(activityItems: shareItems, applicationActivities: nil)
        if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
            activityController.popoverPresentationController?.sourceView = sender
        }
        self.presentViewController(activityController, animated: true,completion: nil)
    }

0 个答案:

没有答案