Updated iOS sample code