Posts

Post marked as solved
7 Replies
4.4k Views
Hi all, I'm struggling to find a way to disable buttons in a UIAlertController of .alert style. I have a textfield, for entering the current password, a button for changing the current password and a button for deleting it. I'd like to disable both password buttons until the current password is correctly entered into the textfield, but I'm struggling to find the solution. If anyone can point me in the right direction it would be much appreciated.
Posted Last updated
.
Post not yet marked as solved
1 Replies
478 Views
Hi, I've been making good progress with learning how to use NSTextFieldDelegate with NSTextField, but I'm struggling with how to use it with NSSecureTextField. Can anyone point me in the right direction? I need to be able to grab the stringValue and work with it when the return key is pressed. The code below works fine for an NSTextField. I obviously need to use a different function, or a different responder type perhaps? func control(_ control: NSControl, textView: NSTextView, doCommandBy commandSelector: Selector) -> Bool {       if (commandSelector == #selector(NSResponder.insertNewline(_:))) {    guard let sender = control as? NSSecureTextField else {return false}    if sender.tag == 1 {     print("It equals 1")    }         if sender.stringValue != "" {       print("field is not empty")      }      self.view.window?.makeFirstResponder(sender.nextKeyView)            return true    }    return false  }
Posted Last updated
.
Post marked as solved
1 Replies
308 Views
Hi, I have a number of NSTextFields on a ViewController and I'm searching for a way to determine which textfield called the DidEndEditing method. Is there a way to do it without adding an IBOutlet for each TextField? func controlTextDidEndEditing(_ obj: Notification) {      } Also, the IBOutlet question raises another question. Is there an equivalent of UIKits IBOutletCollection for AppKit? I've been googling away but haven't found much about it so far. Cheers for any help.
Posted Last updated
.
Post not yet marked as solved
8 Replies
12k Views
Here's my context: User imports a backup file via airdrop, from a laptop to the mobile. My app opens and asks for a password to import and decrypt the file. The user decides to cancel instead, so taps the cancel button. How do I close the app at that point? I have done a lot of googling but so far have not found out how to do it.
Posted Last updated
.
Post not yet marked as solved
0 Replies
527 Views
Hi, I'm having trouble printing a QRCode to the proper size. I pass it, as a UIImage, to a UIActivityViewController and it prints, but at the full width of the A4 page. I've been looking into all kinds of ways to try and shrink it down, but without success. Is there an image equivalent of UISimpleTextPrintFormatter or something along those lines that makes it simple? Do I need to use a UIViewPrintFormatter? Any help greatly appreciated.
Posted Last updated
.
Post not yet marked as solved
1 Replies
817 Views
Hi. I have a question about whether or not a random salt is necessary when there is no centralised database for hackers to attack. It's pretty clear that it's necessary when there is, but is it important when the users simply backup their data to a password encrypted file in a place of their choosing? Is it possible for someone with malicious intent to extract a hardcoded salt from a compiled app?
Posted Last updated
.
Post not yet marked as solved
0 Replies
419 Views
I have the option to use touchID in my app if the user chooses to. I'm wondering though about the cancel option. I'm not planning on having a fallback. If the user decides to cancel it's simply because they've decided to close the app. Can I simply close the app using exit(0), or is this considered bad practice?
Posted Last updated
.
Post not yet marked as solved
3 Replies
581 Views
Hi, I'm having trouble accessing a file on my device. The file is saved to the Files App. On the simulator it runs without a hitch, but on my iPhone it crashes because it doesn't have permission to access the file, even though it created the file. I'm guessing there's probably something that needs setting, perhaps in the info.plist? Supports opening files in place is set to yes, so I've ruled that out as the problem. Any advice much appreciated.
Posted Last updated
.
Post not yet marked as solved
4 Replies
2.9k Views
I'm having trouble calling the openUrlContexts function from SceneDelegate. I have defined a UTI for an exported backup file, and it saves to the files app with no problems. In the simulator my app opens when the saved file is clicked, so it does make the connection there, but no function is called. Does there need to be some setup code to make this function work, or should it automatically fire up when the file is launched?
Posted Last updated
.
Post not yet marked as solved
9 Replies
2.5k Views
Hi, I'd like to offer my users the option to save an encrypted backup of their data, from CoreData, to a place of their choosing. Just a textfile with the data in json format. How I envisage it is that they will click the backup button, a popup will ask them to input a password, then they'll save the outputted file somewhere. I don't know how to implement this. I've been playing around with CryptoKit in a playground, but tutorials seem few and far between. What is available isn't geared towards explaining how to do what I want to do. Does anyone know of a resource or tutorial that could help me learn to implement this feature? Any help much appreciated.
Posted Last updated
.
Post not yet marked as solved
3 Replies
749 Views
Hi all,In my app I have an option for users to create a PDF of their data. I'd like them to be able to save the pdf to a flashdrive or hard disk, but in encrypted form. Is it possibe with CryptoKit? Messing about in playground I've been trying to encrypt a plain string, but I get the error message that String doesn't conform to DataProtocol. How do I need to package the string in order to successfully pass it into the function?let key = SymmetricKey(size: .bits256)let contents = try String(contentsOfFile: filePath.path)let data = contentslet encryptedData = datalet sealedBox = try? ChaChaPoly.seal(encryptedData, using: key)
Posted Last updated
.
Post marked as solved
7 Replies
1.8k Views
Upon updating to Xcode 11 one of my VC files had @available(iOS 13.0, *) add to it, which stops my app from building. It hasn't been added to any other file. Are there some likely reasons for this to be added?
Posted Last updated
.
Post not yet marked as solved
1 Replies
589 Views
Hi, I'm trying to get to come to grips with tableview cells. I asked in another question, but without any response so I'll try reframing the question.Why does this first piece of code show a cell border edge that is inside the tableView cell.layer.borderWidth = 5 cell.layer.borderColor = colorWhereas this code places the border frame way out of sight beyond the edge of the tableView. I have to subtract considerably more than the right_padding to bring it into view. let right_border = CALayer() let right_padding = CGFloat(4.0) right_border.borderColor = color right_border.frame = CGRect(x: cell.frame.size.width - right_padding, y: 0, width: right_padding, height: 70) right_border.borderWidth = right_padding cell.layer.addSublayer(right_border)Is one dealing with the cell boundaries and the other not? Or is the second piece of code placing the frame outside of the cell? I don't see how it could be, but perhaps it is?
Posted Last updated
.
Post not yet marked as solved
2 Replies
681 Views
Hi all, I have a question about structure. I have a backup button in my settingsVC. I have created an NSObject file with the functions that I need. They put CoreData info into an array and iterate what I want from the array into the variable 'backUpFile'. I've accessed the NSObject file from the button in the settingsVC, and it works. My question is, is this an acceptable way to go about it? Does the test object still reside in memory when the operation is done? Do I need to clear it or do some kind of clean up after getting my result?Cheers for any responses.@IBAction func backUpTapped(_ sender: Any) { let test = BackUp() test.getRecords() test.getInfo() let file = test.backUpFile print(file) }
Posted Last updated
.
Post marked as solved
2 Replies
887 Views
Hi,I am trying to use .dictionaryHasDefinition(forTerm: ) to test if a definition exists, but I get this error message:"Unable to copy asset information from https://mesu.apple.com/assets/ for asset type com.apple.MobileAsset.DictionaryServices.dictionary2"I read that UIKit contains a dictionary, but perhaps it doesn't and I have to import it?
Posted Last updated
.