Calabash run_loop fifo error – Swift app not launching in Simulator solution

For the past day or so I’ve been having a problem with calabash where I couldn’t get calabash to launch an ios app in the simulator without encountering a run_loop error saying :

RunLoop::Fifo::NoReaderConfiguredError

Turns out that this is was due to the push notification alert popping up before Instruments had taken control of the simulator. This issue is a known calabash issue – see here.

ios calabash fifo error

SOLUTION

The solution was a two step approach:

  1. Add a delay to the code to prevent the alert popping up too soon. The app was written in SWIFT. I added the delay code to AppDelegate.swift as follows:

//Existing code

        if application.respondsToSelector(“registerUserNotificationSettings:”) {

                    //Newly add code to delay the pop up.

            let time = dispatch_time(dispatch_time_t(DISPATCH_TIME_NOW), 4 * Int64(NSEC_PER_SEC))

            dispatch_after(time, dispatch_get_main_queue()) {

                //Code to be executed with delay

            let settings = UIUserNotificationSettings(forTypes: [UIUserNotificationType.Alert,UIUserNotificationType.Badge,

UIUserNotificationType.Sound], categories: nil)

            application.registerUserNotificationSettings(settings)

            application.registerForRemoteNotifications()

                          }

        }

  2. Add code to my calabash script to accept the alert:

if uia_query(:alert).count > 0
# dismiss by touching ‘OK’
uia_tap_mark ‘OK
end

uia_tap_mark ‘OK’

Advertisements

3 thoughts on “Calabash run_loop fifo error – Swift app not launching in Simulator solution

  1. Hi,
    I’ve had the same problem and we managed that by adding a delay on the push notification alert as well.
    On iOS 9.2, however, it seems that, when 01_launch.rb is called, during the execution of the function
    Calabash::Cucumber::Launcher.relaunch(), the alert is automatically clicked on ‘OK’.
    I didn’t use any command yet.
    Have you seen that kind of behavior?

    • I haven’t worked on that Swift iOS project for a while and my iOS current project doesn’t have an alert on launch, so I can’t confirm this behaviour for you at the moment. I will try to get some time to have a look though and let you know.

Please leave a comment - any questions or feedback welcome.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s