Logout button app crash with IBOutlet and IBAction in Swift

February 8, 2018
Aqueelah
Aqueelah

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.

Xcode is Apple’s integrated development environment for iOS developers. Xcode’s debugging platform has an interactive version of Swift built in. Swift is the successor to both C and Objective-C. For UI button implementation Swift often utilizes IBOutlet and IBActions. IBOutlet is used for referencing something on the iOS storyboard. Storyboards allow you to connect between screens, to view the content of each screen, and to connect view controllers. An IBAction is what happens when a user taps the button.

For our bug of the week, we’re taking a look at an app crash that occurs when the logout button is tapped on a mobile device.

App crash on tap of logout button bug

While testing a messaging application, one of our testers found a bug during mobile testing by attempting to logout on the account detail screen. First, the tester navigated to the settings screen and selected the account details. On the account details screen, they tapped the logout button and the app crashed.

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

Lessons learned and best practices from test IO

This bug highlights the importance of button implementation in the user interface. Whether you choose to drag-and-drop or program a button, you must ensure that all methods and actions are properly connected. Buttons will perform the actions attached to them. With IBOutlet and IBAction, both need to be connected within the interface builder. Afterwards, you can create an action method for the button. One way to do this is by dragging and dropping your button to your view controller. Depending on which Swift version you are using there are a few different ways to do so.

In this case, the app may have crashed because the button was not properly implemented. There could have been a command improperly typed as well. This is why it is important to view your debug log. Here’s a scenario similar where the developer mentions an issue with the logout functionality. To avoid these kinds of issues on your mobile app, connect IBOutlet and IBAction, add the action method, and don’t forget to properly debug.

Read More

March 12, 2020
Tester Spotlight - Alex Che

We’re able to do what we do because of our incredible and diverse community of testers. Meet Alex, a Policeman now QA Engineer who gained the real-world QA experience he needed to change careers testing with test IO.

March 10, 2020
A Benefit of Crowdtesting - Time Compression

When budgeting for crowdtesting in the coming years, it's important to know all the value it adds. Here a little more on one of those values, time compression.

February 27, 2020
A test IO Bug's Life

You click submit on a new crowdtest and go home. When you wake, detailed bug reports are waiting in your Jira. But how did they get from the tester to you?

Ship Faster, Sleep Better

Get a Demo
twitterfacebooklinkedin