I'm creating an app that gets a file from Icloud and converts it into a b64 format string, but I have a problem:
I really don't know how to get the data from this file. I thought that could be easy opening the Path from the imported file from ICloud but It returns nil when I try to acess to the route.
My code example is here, as you can see I have the temp route :( (file:///.../Aplication/xxx-xxx-xxx-xx/temp/com.domain.AppName/Carolina.cer):
extension KeyViewController: UIDocumentMenuDelegate {
    func documentMenu(documentMenu: UIDocumentMenuViewController, didPickDocumentPicker documentPicker: UIDocumentPickerViewController) {
        documentPicker.delegate = self
        print ("documentMenu")
        self.presentViewController(documentPicker, animated: true, completion: nil)
    }
}
extension KeyViewController: UIDocumentPickerDelegate {
func documentPicker(controller: UIDocumentPickerViewController, didPickDocumentAtURL url: NSURL) {
    print("url string")
    print(String(url))
//prints file:///.../Aplication/xxx-xxx-xxx-xx/temp/com.domain.AppName/Carolina.cer
if controller.documentPickerMode == UIDocumentPickerMode.Import {
            if (NSFileManager.defaultManager().fileExistsAtPath(String(url))){
                    print("exists")
            }
            else{
                    print("not exists")
            }
        dispatch_async(dispatch_get_main_queue()) {
            if let fileName = url.lastPathComponent {
                var fileNameArray = fileName.componentsSeparatedByString(".")
                print ("fileNameArray")
                print (fileNameArray)
                if ((fileNameArray[1] != "cer") && (fileNameArray[1] != "key")) {
                    self.alertMessage = "Not a valid selection, choose .cer or .key Files"
                    self.showAlertMessage(self.alertMessage)
                }
                else{
                //saving the name
                    if (fileNameArray[1]=="cer")
                    {
NSUserDefaults.standardUserDefaults().setObject(fileName, forKey: "temporalCerFile")
                    }
                    else{
                    //saving the name
NSUserDefaults.standardUserDefaults().setObject(fileName, forKey: "temporalKeyFile")
                    }
NSUserDefaults.standardUserDefaults().synchronize()
                    }
                }
            }
        }
    }
}
How can I get the content inside the file?. Please, hope you can help me