Added explicit casts to prevent compiler warnings when trying to build for iOS