Giter Site home page Giter Site logo

qfjspatch's Introduction

###写在前面 JSPatch的诞生让iOS平台应用实现热更新变得非常方便, 这是一套服务端+客户端的开源解决方案,让iOS开发者也能很方便的集成JSPatch、搭建服务端,不再需要求助于很忙的服务端开发人员。

======= ###贡献者 沉睡的军哥

======= ###使用步骤

####服务端

  1. 安装nodejs(自行安装)

  2. 安装sails
    npm -g install sails

  3. 安装pm
    npm -g install pm2

  4. 启动服务端应用
    ①生成RSA公钥私钥,参考http://www.jianshu.com/p/bfa57e049a7e

    ②将jspatchserver放在服务端,将第一步得到的私钥命名为private_key.pem, 放入jspatchserver/patch/pem目录下

    ③在jspatchserver/patch/js目录下创建以APP命名(自定)的目录,例如TestAPPName,然后在TestAPPName目录下放入需要修复BUG的js文件,命名格式为patch+版本号.js(例如patch1.0.0.js)

    ④定好要使用的端口号,并映射好域名

    ⑤找到jspatchserver/config/local.js文件, vi打开(或者其他方式), 找到port: process.env.PORT这一行,将后面的端口号修改为你在上一步定好的端口号, 例如我要使用端口号8000(port: process.env.PORT || 8000),shift + ':' wq保存退出

    ⑥cd到jspatchserver目录下执行npm install

    ⑦执行pm2 start app.js,启动成功,恭喜你,在浏览器中录入你的域名+端口号/jspatch?version=你要修复的版本号&appName=你APP的命名,例如(test.patch.com:8000/jspatch?version=1.0.0&appName=TestAPPName),可以正常看到返回数据,说明环境已通, 你现在可以将需要更新的jspatch(什么?你还没有使用过jspatch, 去这里看看吧https://github.com/bang590/JSPatch,还有这里http://bang590.github.io/JSPatchConvertor/)文件放入jspatchserver/patch/js目录下热修复你的应用了,是不是很简单。

=======
####客户端 1.CocoaPods集成

# Your Podfile
platform :ios, '6.0'
pod 'QFJSPatch'

2.手动集成 QFJSPatch目录下的代码导入工程

3.使用
①将在服务端使用过程中生成的公钥命名为public_key.pem,导入到客户端工程

②在合适的位置引入#import "QFJSPatch.h"

③在didFinishLaunchingWithOptions中调用[QFJSPatch execJS];,
applicationDidBecomeActive或者你认为更合的位置调用[QFJSPatch requestJSWithUrl:@"test.patch.com:8000/jspatch?" appName:@"TestAPPName"];

好了,现在你再也不怕线上出BUG了。

=======

###相关阅读 该解决方案与node.js、sails.js、pm2等有关,相关资料如下

  1. nodejs官方网站
  2. sails.js官方网站
  3. pm2

=======

qfjspatch's People

Contributors

cashlzcj avatar

Stargazers

trailside avatar

Watchers

trailside avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.