From 64d45e4b3e2face67b6a3a0c8873b82ecbce5603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AC=BC=E9=81=93?= Date: Tue, 19 Apr 2016 15:16:51 +0800 Subject: [PATCH] * [example] support ios entry --- examples/index.we | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/index.we b/examples/index.we index 4d9fa3767f..af8b8f3664 100644 --- a/examples/index.we +++ b/examples/index.we @@ -28,10 +28,16 @@ var bundleUrl = this.$getConfig().bundleUrl; console.log('hit', bundleUrl); var nativeBase; - if (bundleUrl.indexOf('your_current_IP') >= 0) { - // in Android assets + var isAndroidAssets = bundleUrl.indexOf('your_current_IP') >= 0; + var isiOSAssets = bundleUrl.indexOf('file:///') >= 0 && bundleUrl.indexOf('WeexDemo.app') > 0; + if (isAndroidAssets) { nativeBase = 'file://assets/'; } + else if (isiOSAssets) { + // file:///var/mobile/Containers/Bundle/Application/{id}/WeexDemo.app/ + // file:///Users/{user}/Library/Developer/CoreSimulator/Devices/{id}/data/Containers/Bundle/Application/{id}/WeexDemo.app/ + nativeBase = bundleUrl.substring(0, bundleUrl.lastIndexOf('/') + 1); + } else { var host = 'localhost:12580'; var matches = /\/\/([^\/]+?)\//.exec(this.$getConfig().bundleUrl);