- 1、進(jìn)入項(xiàng)目目錄
cd /Users/cjp/Desktop/DemoZC/ios
- 2灌侣、打開終端:
npm start
- 3推捐、使用curl命令生成 main.jsbundle
curl http://localhost:8081/index.ios.bundle -o main.jsbundle
- 4、jsCodeLocation修改訪問:注釋掉localhost的URL方式侧啼,通過main的bundle方式加載
// swift
let jsCodeLocation = NSBundle.mainBundle().URLForResource("main", withExtension: "jsbundle") //NSURL(string: "http://localhost:8081/index.ios.bundle?platform=ios&dev=true")
- 4牛柒、選擇真機(jī)堪簿,編譯即可看見
main.jsbundle.png