Xcode, Android Studio, React js, Angular js, Xamarin, no matter your guilty pleasure for app building, you’ve utilized view controllers. Enticing users screen by screen, designing and developing an interface that speaks to their user behavior. What happens if a view controller is not retaining data when a user navigates to another screen?

This post is part of a series on the test IO blog about real bugs that our testers have found during test cycles. In each post, we explore the details of the issue, explain its impact, and discuss what software teams can do to avoid similar problems.

View controllers are the backbone of your app’s user interface. They manage the hierarchy of each view, underlying data interactions, and screen transitions. Every app has at least one view controller. However, most apps have several. There are two types of view controllers: content and container. The content view controls the app’s content and the container view controls the navigation and presents content to the various controllers.

For our bug of the week, we’re taking a look at a sign-up usability bug that causes entered data to disappear when navigating between screens.

App screen view controller bug

While testing the sign-up process on a messaging application, one of our testers found a bug while performing usability testing. The tester was attempting to sign-up for a new account, which asks for their name, password, email address, and phone number.

In the sign-up process, the user also needed to select the country code for their phone number. To do this, the app navigated the user to another screen and view to choose the country code. Once the user selected the country code from a list of countries and went back to the previous screen view, their name and email address disappeared. However, their password remained on the screen and their country code had been successfully added.

The bug was initially discovered on Apple iPhone 5s, iOS 11.1. However, it ended up being reproducible on multiple devices and operating system versions.

Lessons learned and best practices from test IO

This bug highlights the importance of the model view controller.  The layout and the design of the app take the user’s mobile device into account. Due to the constraints of the mobile screen size the user can not complete the sign-up process without navigating to a different screen, which seems like reasonable behavior for this particular screen size. Rather than having the user scroll through country codes on the same screen, they are directed to another screen. However, the view controller logic does not seem to properly handle the navigation.

What should the view controller be doing instead? If an app requires a user to navigate to another screen or view, it should retain any entered data. This can be done by using the same view controller for each of the screens in that process. Apple has some information in their iOS guide where they discuss navigation and view controllers. Though each development platform will have slightly different instructions, properly managing the views are essential to this process. Furthermore, developers should also ensure that all TextField objects on the screen have the same behavior, as a view is an object. In this example, name, email and password are TextField objects. So while each text field is considered its own object, only password saved, which means the fields were behaving differently.