I was in objective-c before. and this code below in objective C is working fine:
in. h
@property (retain)UIDocumentInteractionController *docControll
try this:
var docController: UIDocumentInteractionController?
if let path = NSBundle.mainBundle().pathForResource("book", ofType: "pdf") {
if let targetURL = NSURL.fileURLWithPath(path) {
docController = UIDocumentInteractionController(URL: targetURL)
let url = NSURL(string:"itms-books:");
if UIApplication.sharedApplication().canOpenURL(url!) {
docController!.presentOpenInMenuFromRect(CGRectZero, inView: self.view, animated: true)
println("iBooks is installed")
}else{
println("iBooks is not installed")
}
}
}