Post

Replies

Boosts

Views

Activity

Reply to instantiated view controller displays for 1 second then segues to next view controller for no reason
The class declaration: import UIKit import PaperOnboarding class SchoolSignUpOnboardingViewController: UIViewController {   override func viewDidLoad() {     super.viewDidLoad()     setupUI()     let onboarding = PaperOnboarding()     onboarding.dataSource = self     onboarding.translatesAutoresizingMaskIntoConstraints = false     view.addSubview(onboarding)     // add constraints     for attribute: NSLayoutConstraint.Attribute in [.left, .right, .top, .bottom] {      let constraint = NSLayoutConstraint(item: onboarding,                        attribute: attribute,                        relatedBy: .equal,                        toItem: view,                        attribute: attribute,                        multiplier: 1,                        constant: 0)      view.addConstraint(constraint)     }   }     } Also, it is a segue connection that connects SchoolSignUpOnboardingVC - SchoolDashboardTableVC and it is triggered by a bar button item. @Claude31
Apr ’21
Reply to instantiated view controller displays for 1 second then segues to next view controller for no reason
Ok cool, so the first View Controller is the SchoolSignUpViewController, this where a school user signs up, when they are done, they press the sign up button and I want them to see the SchoolSignUpOnboardingViewController aka nextVC via instantiation. Here is the function for that desired action I want:  @IBAction func signupPressed(_ sender: UIButton) {     let validationError = validateFields()     let schoolName = schoolNameTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)     let schoolEmail = schoolEmailTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)     let schoolPassword = schoolPasswordTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)     let schoolID = schoolIDTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)     let schoolDistrict = schoolDistrictTextField.text!.trimmingCharacters(in: .whitespacesAndNewlines)     let dateCreated = Date()           if validationError != nil {       return     } else {       //Create user       Auth.auth().createUser(withEmail: schoolEmail, password: schoolPassword) { (result, error) in                   guard error == nil else {           self.showAlert(title: "Error Signing Up", message: "There was an error creating the user, please check your connection and try again later.")           return         }           let db = Firestore.firestore()           guard let result = result else { return }           db.document("school_users/\(result.user.uid)").setData(["school_name":schoolName,                                        "school_id":schoolID,                                        "remindersPushNotificationsOn": true,                                        "updatesPushNotificationsOn": true,                                        "schoolDistrict":schoolDistrict,                                        "time_created":dateCreated,                                        "userID": result.user.uid],                                        merge: true) { (error) in             guard error == nil else {               self.showAlert(title: "Error Signing Up", message: "There was an error creating the user, please check your connection and try again later.")               return             }           }                       let changeRequest = result.user.createProfileChangeRequest()           changeRequest.displayName = schoolName           changeRequest.commitChanges { (error) in             guard error == nil else {               return             }             print("School Name Saved!")           }                             }       guard let nextVC = storyboard?.instantiateViewController(withIdentifier: Constants.StoryboardIDs.SchoolOnboarding) as? SchoolSignUpOnboardingViewController else { return }       navigationController?.pushViewController(nextVC, animated: true)     }   }     when this is called, this is where the transition from SchoolSignUpVC to SchoolSignUpOnboardingVC is supposed to happen. Instead, what ends up happening is the SchoolSignUpOnboardingVC shows up for literally a split second on screen, and then it vanishes and segues to the SchoolDashboardTableVC. The transition that does not work as expected is the sign up button, it instantiates the correct view controller yes, but it does for one second and doesn't even allow the user to interact with the screen. Here is the full code for the SchoolSignUpOnboardingVC : extension SchoolSignUpOnboardingViewController: PaperOnboardingDataSource {       func onboardingItem(at index: Int) - OnboardingItemInfo {     let next = (UIImage(systemName: "chevron.right.circle")?.mask(with: .white))!     let titleFont = UIFont(name: Constants.AppFonts.menuTitleFont, size: 20) ?? UIFont.boldSystemFont(ofSize: 20)     let descripFont = UIFont(name: Constants.AppFonts.consistentFont, size: 17) ?? UIFont.boldSystemFont(ofSize: 17)           ... way too much code for answer   }       func onboardingItemsCount() - Int {     return 7   }           func setupUI() {     let navbar = navigationController?.navigationBar     let appearance = UINavigationBarAppearance()     appearance.backgroundColor = colorLiteral(red: 0.3084011078, green: 0.5618229508, blue: 0, alpha: 1)     appearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont(name: Constants.AppFonts.menuTitleFont, size: 22) ?? UIFont.boldSystemFont(ofSize:22)]     appearance.shadowColor = .clear     navbar?.standardAppearance = appearance     navbar?.compactAppearance = appearance     navbar?.scrollEdgeAppearance = appearance     navbar?.prefersLargeTitles = false     navigationItem.setHidesBackButton(true, animated: true)     navigationItem.title = "How Gothere Works"     navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(systemName: "chevron.right.2"), style: .done, target: self, action: #selector(gotoAddAnEventPage))     navigationItem.rightBarButtonItem?.tintColor = .white         }           @objc func gotoAddAnEventPage() {     performSegue(withIdentifier: Constants.Segues.fromSchoolOnboardingToSchoolAddAnEvent, sender: self)   }     } And then in the actual View Controller file: class SchoolSignUpOnboardingViewController: UIViewController {   override func viewDidLoad() {     super.viewDidLoad()     setupUI()     let onboarding = PaperOnboarding()     onboarding.dataSource = self     onboarding.translatesAutoresizingMaskIntoConstraints = false     view.addSubview(onboarding)          for attribute: NSLayoutConstraint.Attribute in [.left, .right, .top, .bottom] {      let constraint = NSLayoutConstraint(item: onboarding,                        attribute: attribute,                        relatedBy: .equal,                        toItem: view,                        attribute: attribute,                        multiplier: 1,                        constant: 0)      view.addConstraint(constraint)     }   }     } The SchoolDashboardVC has way too many lines of code to post in this thread it wouldn't make sense, the main issue is the transition from SchoolSignUpVC to the SchoolSignUpOnboardingVC. The Transition should be : SchoolSignUpVC - SchoolSignUpOnboardingVC - SchoolDashboardTableVC instead it's like : SchoolSignUpVC - SchoolSignUpOnboardingVC (for 1 split second) - SchoolDashboardTableVC. @Claude31
Apr ’21
Reply to instantiated view controller displays for 1 second then segues to next view controller for no reason
Ok i'll try my best to re-explain, the "nextVC" (aka the correct vc) shows up for a split second with all the UI and everything meaning the view controller instantiation was successful but then it automatically segues to the DashboardVC (the vc I want users to goto after nextVC). I am aware I push the nextVC, I didn't mean to say segue, but when that vc loads for a split second you don't even have time to interact with it, it automatically segues to the DashboardVC. Here is what prints in the console when I finish authenticating: ocean@gmail.com School Name Saved! Algolia Search Client Swift: Default minimal log severity level is info. Change Logger.minLogServerityLevel value if you want to change it. 2021-04-19T14:03:59-0400 info com.algolia.InstantSearchCore : Default minimal log severity level is info. Change Logger.InstantSearchCore.minLogSeverityLevel value if you want to change it. Permission granted: true Notification settings: UNNotificationSettings: 0x13332fed0; authorizationStatus: Authorized, notificationCenterSetting: Enabled, soundSetting: Enabled, badgeSetting: Enabled, lockScreenSetting: Enabled, carPlaySetting: NotSupported, announcementSetting: NotSupported, criticalAlertSetting: NotSupported, alertSetting: Enabled, alertStyle: Banner, groupingSetting: Default providesAppNotificationSettings: No 2021-04-19 14:03:59.080697-0400 Gothere[20652:174544] 7.5.0 - [Firebase/Messaging][I-FCM012002] Error in application:didFailToRegisterForRemoteNotificationsWithError: remote notifications are not supported in the simulator Failed to register: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo={NSLocalizedDescription=remote notifications are not supported in the simulator} Subbed to Invoices Subbed to GothereUpdates. Also when the nextVC loads for that split second, it isn't displaying the "rightBarButtonItem" that I added into the UI Setup. Here is the code for the nextVC UI as well:  func setupUI() {     let navbar = navigationController?.navigationBar     let appearance = UINavigationBarAppearance()     appearance.backgroundColor = colorLiteral(red: 0.3084011078, green: 0.5618229508, blue: 0, alpha: 1)     appearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont(name: Constants.AppFonts.menuTitleFont, size: 22) ?? UIFont.boldSystemFont(ofSize:22)]     appearance.shadowColor = .clear     navbar?.standardAppearance = appearance     navbar?.compactAppearance = appearance     navbar?.scrollEdgeAppearance = appearance     navbar?.prefersLargeTitles = false     navigationItem.setHidesBackButton(true, animated: true)     navigationItem.title = "How Gothere Works"     navigationItem.leftBarButtonItem = UIBarButtonItem(image: UIImage(named: "xmark"), style: .done, target: self, action: #selector(closeTapped))     navigationItem.leftBarButtonItem?.tintColor = .white     navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(systemName: "chevron.right.2"), style: .done, target: self, action: #selector(gotoAddAnEventPage))     navigationItem.rightBarButtonItem?.tintColor = .white         }       @objc func closeTapped() {     performSegue(withIdentifier: Constants.Segues.fromSchoolOnboardingToSchoolEvents, sender: self)   }       @objc func gotoAddAnEventPage() {     performSegue(withIdentifier: Constants.Segues.fromSchoolOnboardingToSchoolAddAnEvent, sender: self)   } The new addition is the nextVC, that's what I meant by the new addition, I added it this morning to the project but it seems to be screwing everything up. In regards to TestFlight, this isn't related, the simulator and the builds on TestFlight are two different things, the goal is to just get this to work on the simulator, once I know it works on the simulator I can upload it to TestFlight. Hopefully this clears things up. @Claude31
Apr ’21