Thanks heaps, Eskimo. I'll take a look at it all and see if I can nut it out. I'm very much a novice, so I may have some more questions after I've tackled what you've given me.Cheers
Post
Replies
Boosts
Views
Activity
I think I've got the logic of it now. Because I'm a bit slow, could you please correct me if I have this wrong.1. A key is derived from a password.2. It's used to encrypt the textfile.3. It can then be gotten rid of, because when it comes to decryption the same key will be derived from password input again and used to decrypt the file?
Thanks heaps. I have it running nicely in the playground. I spent quite a bit of time going down a few deadends trying to work out how to save it, until I cottoned on to saving it as Data. I hope you don't mind if I ask a few more questions.I've saved it this way:let filename = getDocumentsDirectory().appendingPathComponent("backup.txt")//Write to filedo { let e = Data(encryptedData.combined!) try e.write(to: filename)Is saving it to a standard .txt file okay?Also, for arguments sake, if the salt and rounds needed to be hidden, how would that be handled? I don't know anything about what happens when an app is installed, but I imagine the salt and rounds could be stored in a file and then, during installation, written to the keychain while the file is deleted, or would that be insecure? I guess that any values that required high security could be encrypted and then unencrypted during the installation process for passing into the keychain.Sorry for so many questions, but I have one more. I know that the iPhone is encrypted as a whole, but if I wanted to have encryption on top of that, within my app, is cryptokit suitable for implementing that, or would common crypto be the better option?
Cheers. It's a poor choice, but I have no idea what would be the right choice. If it was an image then it's jpeg, or png, or something obvious, but with lots of googling and time I still haven't tracked down what an encrypted data file ought to be.
Now to hunt down some info on how to do it.Thanks for all your help.
I've discovered that the code below is need in willConnectTo session, so that's one step forward :-)self.scene(scene, openURLContexts: connectionOptions.urlContexts)
I'm still struggling with this. I've read the UIScene documentation but still cannot see where I am going wrong. As I said, my file opens the app, it just doesn't call the openURLContexts function. As I understand it, iOS should automatically pass information about the file that opened the app to the ScenesDelegate, which would include the url to the file. Or do I have that wrong?
The line of code that I mentioned above, that I placed in the willConnectTo method only calls the openURLContexts method when the app is initially launched, not when it is launched from a saved file. Any help will be much appreciated.
Thank you. That one did slip by me. I’ve been doing a lot of experimenting in practice projects and the method is being called now without having to manually call it. I’m not sure what the initial problem was, but I suspect a setting in the info.plist. If the app is set to not run in the background the app Will start from an exported file, but openURL does not get called.
Hi eskimo, I've discovered my error. I set "open document in place" to NO, and it now imports and processes without a problem.
I was using the guard statement below, and when it wasn't working I tried the do statement, which didn't work either. I haven't tried the guard statement yet to see if it works since changing the setting, but I suspect that it will.
I don't know why it wasn't working. I guess it has something to do with the url having private in its path. I've got some learning to do there.
"Failed reading from URL: file:///private/var/mobile/Containers/Shared/AppGroup/FC9D99"
var data = Data()
do {
data = try Data(contentsOf: url)
}catch let error as NSError{
print("Failed reading from URL: \(url), Error: " + error.localizedDescription)
}
//guard let data = try? Data(contentsOf: url) else { return "blah" }
BTW, the error basically said that the app "doesn't have permission to view the file". Is there a way to grant it permission? Having the app open up by tapping on the file is a very nice feature.
Same here, as of an hour ago. I wish I hadn't updated.
Every time I download from apple servers it takes forever. Xcode literally always takes me hours to download and install. It's never a joy, especially this time when Xcode 12.1 isn't running very well. It's slowing down my computer, crashing Spotlight, and not starting up my app properly. It ran like a dream prior to updating.
Sorry, I didn't see your reply. Yes, exit(0) closes the app okay, but it means that things don't work properly the next time the user tries to import the backup file. The app will open, but OpenURLContexts doesn't run.
Actually, it just occurred to me that is the actual issue. If the app isn't sitting in the background, and is starting from scratch, OpenURLContexts does not run, so importing a backup file will not work even if the user hasn't canceled. I need a way to make it run.
Thanks, Claude31
I was wondering the same thing about exit(0). Quite a few people say that would be rejected, but then I see others who have had no issue with it. I have an app on my phone where I think the developer has exit(0) in the cancel button. It certainly looks like it when I press the cancel button.