Try to use/modify this commit to run in iOS.