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

November 25, 2019
iOS testing: TestFlight or Resigner

Here's our guide to which method you should use you to distribute your IOS app to the crowd.

November 15, 2019
Exploratory Testing vs. Test Case Testing

Exploratory testing emphasizes creativity and learning. Test Case testing emphasizes planning and execution. Which one is right for you?

July 19, 2019
Reducing Risk in Agile Development

How can you reduce risk when implementing agile development in your SDLC?

Ship Faster, Sleep Better

Get a Demo
twitterfacebooklinkedin