Post

Replies

Boosts

Views

Activity

Reply to How to pull a contacts mailing address using the mailing address label?
Thank you very much! I've been struggling with this for over a week. After I posted this question I was thinking whether I should use the address ID or the address label to perform this operation. My thought is that if the user gets a new phone and loads the app then the address IDs would be different and that might cause a problem. However, the address label would be the same. Am I over thinking this?
Apr ’20
Reply to Open a CNContactViewController and edit a contact
Thanks again, OOPer.Just in case others have he same requirment, here's the code I ended up with.let theAlert = UIAlertController(title: NSLocalizedString("ContactNoAddress_String", comment: ""), message: nil, preferredStyle: .alert) let cancelBtn = UIAlertAction(title: NSLocalizedString("OK_String", comment: ""), style: .cancel) { (cancelAction) in self.populateThePrintFld() } let editBtn = UIAlertAction(title: NSLocalizedString("EditContact_String", comment: ""), style: .default) { (editAction) in self.requestAccess { (accessGranted) in let store = CNContactStore() var vc = CNContactViewController() do { let descriptor = CNContactViewController.descriptorForRequiredKeys() let editContact = try store.unifiedContact(withIdentifier: self.theContactID, keysToFetch: [descriptor]) vc = CNContactViewController(for: editContact) } catch { print("Getting contact to edit failed: \(error)") } vc.allowsEditing = true vc.delegate = self // delegate for CNContactViewControllerDelegate DispatchQueue.main.async { self.present(UINavigationController(rootViewController: vc), animated: true) } } } theAlert.addAction(cancelBtn) theAlert.addAction(editBtn) present(theAlert, animated: true)extension QuotePreview_VC: CNContactViewControllerDelegate { func contactViewController(_ viewController: CNContactViewController, didCompleteWith contact: CNContact?) { // Edit an existing contact with ID theContactID populateThePrintFld() self.dismiss(animated: true, completion: nil) } }
Apr ’20
Reply to Open a CNContactViewController and edit a contact
Thanks. I appreciate that.Seems strange that in a select a contact CNContactPickerViewController() and a create a contact CNContactViewController(forNewContact: openContact) both show cancel buttons. And in the contacts app, if you manually edit a contact, it shows a back button. It's odd that it doesn't automatically show up on the edit a contact CNContactViewController(for: editContact).
Apr ’20
Reply to Open a CNContactViewController and edit a contact
Here's what I ended up doing. It dosen't give a cancel button but it does show a back button, which in my case works ok.let editBtn = UIAlertAction(title: NSLocalizedString("EditContact_String", comment: ""), style: .default) { (editAction) in self.requestAccess { (accessGranted) in let store = CNContactStore() var vc = CNContactViewController() do { let descriptor = CNContactViewController.descriptorForRequiredKeys() let editContact = try store.unifiedContact(withIdentifier: self.oldContactID, keysToFetch: [descriptor]) vc = CNContactViewController(for: editContact) } catch { print("Getting contact to edit failed: \(error)") } vc.delegate = self // delegate for CNContactViewControllerDelegate // vc.allowsActions = false // vc.allowsEditing = true // vc.title = "Edit Contact" self.navigationController?.isNavigationBarHidden = false self.navigationController?.navigationItem.hidesBackButton = false self.navigationController?.pushViewController(vc, animated: true) // DispatchQueue.main.async { // self.present(UINavigationController(rootViewController: vc), animated: true) // } } }
Apr ’20
Reply to preferredStatusBarStyle not firing in iOS 13.4
So I created a test app in xcode 11.4.1Ran it and the print statement fired.Then I ran it in xcode 13.3.1The print statement fired.Then I embedded the view in a navigationColtrollerThen I ran it in xcode 13.3.1The print statement did not fire.Then I ran it in xcode 13.4.1The print statement did not fire.Then I deleted navigationColtrollerThen I ran it in xcode 13.3.1The print statement fired.Then I ran it in xcode 13.4.1The print statement fired.It's the same in the sim or device.override var preferredStatusBarStyle: UIStatusBarStyle { print("preferredStatusBarStyle fired") return .lightContent }
Apr ’20
Reply to preferredStatusBarStyle not firing in iOS 13.4
So far I am still trying to figure this out. My app has 51 views and one navigation controller linked to the first view. I tried updating the cocoa pods. I've looked at everywhere in my app that I set the preferredStatusBarStyle. There doesn't seem to be a correlation. It still works fine on Xcode 11.3.1 but preferredStatusBarStyle doesn't fire on 11.4 or 11.4.1I have a theme protocol and three themes following it (lite, grey and dark). The themes set the preferredStatusBarStyle to .default or .lightContentThis is from the LiteThemevar barStyle: UIStatusBarStyle = .defaultThis is in every viewController override var preferredStatusBarStyle: UIStatusBarStyle { return Theme.current.barStyle }
Apr ’20
Reply to Two finger swipe on a UIImage
Hi Claude,Thanks you for checking into this.I also tested the app on my iPhone XS MAX and my iPhone 6s and you are correct. It does work as expected on the physical devices. I apologize for not following through on testing on the device. I guess I just got wrapped around the axle when it didn't work on the sim.I'm in the final stages of finishing a series of 8 apps and this through a monkey wrench into the works.I do not have an iPad to test on. I'll try to find someone with an iPad to test it. Until then I'm not comfortable releasing any apps using this code.Thank you,Tom
May ’20
Reply to Determine when a view becomes active
Thanks PBK,I tried at least 6 ways of doing this but this was the only one the worked.I had to figure out a little more about NotificationCenter than I originally knew but I got it working.Even figured out how to pass data to the parrent VC in the Notification// In parrent static let notificationName = Notification.Name("ClosingChild") override func viewDidLoad() { super.viewDidLoad() NotificationCenter.default.addObserver(self, selector: #selector(returnFromPopup), name: Tally_VC.notificationName, object: nil) }// End of viewDidLoad @objc func returnFromPopup(notification: Notification) { if let data = notification.userInfo?["data"] as? Bool { if data { self.populateTheData() self.tableView.reloadData() } else { //print("It didn't run") } } } // In child var pass_Popup: Bool = false override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) setThe_Pass_Bool() NotificationCenter.default.post(name: Tally_VC.notificationName, object: nil, userInfo: ["data": pass_Popup]) }
May ’20