Error treatment updated for IOS

Now works fine.