JSPatch使用
JSPatch 热更新 参考文档 jspatch语法 JSPatchConvertor 这个转换代码不能直接使用 原理 装换工具 (js对象转oc对象) // JSChange.h #import <Foundation/Foundation.h> @interface JSChange : NSObject + (instancetype)boxObj:(id)obj; @end // JSChange.m #import "JSChange.h" @interface JSChange () @property (nonatomic) id obj; @end @implementation JSChange + (instancetype)boxObj:(id)obj { JSChange *boxing = [[JSChange alloc] init]; boxing.obj = obj; return boxing; } @end //用法 JSChange.boxObj("www.Q1231321132Q.com").obj() 嵌入项目代码 1 cocoapods target 'MIOS' do platform :ios, '8.0' pod "JSPatch" end 2 js嵌入 [JPEngine startEngine]; NSString *sourcePath = [[NSBundle mainBundle] pathForResource:@"mq" ofType:@"js"]; NSString *script = [NSString stringWithContentsOfFile:sourcePath encoding:NSUTF8StringEncoding error:nil]; [JPEngine evaluateScript:script]; 3 jsDemo require('UIColor,NSString,NSURLRequest,NSURL,JSChange'); defineClass('WebTest', { // viewDidLoad:……