rewrite of iOS parts to use new sdk

js handling broken
need to use background thread