Added more code for ios

Added code to support new ios project, also did some more clean up and
errors found by mac and ios compilers