将打完包的js文件运行到iOS平台

2017-08-03  本文已影响21人  碧玉小瑕

1.创建一个iOS工程

2.使用pod导入相关库:

podFile例子:

# Uncomment this line to define a global platform for your project

platform :ios,'7.0'#weex sdk最低依赖的iOS版本为7.0

target'WeexProjectThird'do

# Uncomment this line if you're using Swift or would like to use dynamic frameworks

# use_frameworks!

# Pods for WeexProjectThird

pod'WeexSDK'#不指定版本

pod'WXDevtool','0.8.0'

pod'SDWebImage','3.7.5'

pod'SocketRocket','0.4.2'

pod'ATSDK-Weex','0.0.1'

end

执行pod install

运行发现报错:

Targets->Build Phases->Link Binary With Libraries中添加libsqlite3.0.tbd静态库文件即可。

3.导入打包后的js文件:

4. 在appDelegate中导入相关库,并初始化weex运行环境

5.在容器VC中初始化weex根容器WXSDKInstance的实例,并加载执行导入的js文件:

run工程:

6.记得在dealloc中销毁weekSDK实例:

上一篇 下一篇

猜你喜欢

热点阅读