@vinit @hardik_d I have used this in my code (hybrid ios) works for me. ensure you do have the alert\error message up before switching to alert. my code is in python.
211 @then(u'Error Message is shown')
212 def step_impl(context):
213 context.app.wd.implicitly_wait(60)
214 context.app.wd.switch_to_alert()
215 context.app.wd.find_element_by_name("OK").click()