native.showAlert sometimes quits displaying on ios

In my app I have a form with a native.newTextField that has a button beside it. If they click the button it opens up the plugin.qrscanner and scan a barcode, or they can type the value in the text field and the text box has a userInput event listener with the following code.

[lua]

local function boxListener(event)

  if ( event.phase == “began” ) then

  elseif ( event.phase == “ended” or event.phase == “submitted” ) then

    local message = {}

    message.isError = false

    message.message = event.target.text

    scene:scannerCallback(message)

   elseif ( event.phase == “editing” ) then

   end

end

[/lua]

where scannerCallback is the same function that the qrscanner returns its value to. It checks to see if the value is valid and displays a native.showAlert if it is not. The problem is that after using the app for a period of the time native.showAlert stops displaying, and not just for this case, but every time the showAlert is called subsequently in any part of the app, until you shut down the app completely and restart it. Anyone have any ideas on what could be causing this? I can’t find any rhyme or reason on why it suddenly stops working.  This doesn’t happen on the simulator, but happens when I build it to an iPhone 6. I haven’t tried it on any other devices as this is the specific device my client will be using.

[lua]

function scene:scannerCallback(event)

  if event.isError == false then

    local lotNumber = event.message

   print(“scannerCallback”)

    if(lotNumber ~= scene.m_displayObjects[“lotNumber”].text) then

      scene.m_nativeObjects[“box”]:setText("")

      print(“showing error the box is not part of hte lot”)

      native.showAlert(“Error”, “The box is not part of the lot.”, {“OK”})

    else

      scene.m_nativeObjects[“box”]:setText(lotNumber)

    end

  else

    print(‘Error occured:’, event.errorCode, event.errorMessage)

  end

end

[/lua]

Discovered this was because I had two network.request calls that were sometimes coming back with responses that then displayed the native.showAlert.  If two native.showAlerts are trying to be shown at the same time iOS freaks and silently fails and won’t show any future alerts.

Discovered this was because I had two network.request calls that were sometimes coming back with responses that then displayed the native.showAlert.  If two native.showAlerts are trying to be shown at the same time iOS freaks and silently fails and won’t show any future alerts.