swift activityViewController发送pdf

时间:2016-05-09 16:50:32

标签: swift pdf uiactivityviewcontroller

如何使用activityController将存储在iphone中的pdf保存到ibooks?

我的代码是`pageSize = CGSizeMake(850,1100)

    let fileName: NSString = "Cars.pdf"

    let path:NSArray = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)

    let documentDirectory: AnyObject = path.objectAtIndex(0)

    let pdfPathWithFileName = documentDirectory.stringByAppendingPathComponent(fileName as String)

    self.generatePDFs(pdfPathWithFileName)

    //lines written to get the document directory path for the generated pdf file.

    if let documentsPath = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first?.path {

        print(documentsPath)

let File  = [documentDirectory]
let activityViewController : UIActivityViewController = UIActivityViewController(activityItems: File, applicationActivities: nil)
            presentViewController(activityViewController, animated: true, completion: nil)`

但它只显示邮件中的documentDirectory ..我需要说些什么..嘿,有一个pdf文件......

0 个答案:

没有答案