Code cleanup and fix iOS build.
[ci package]