hite / apphost Goto Github PK
View Code? Open in Web Editor NEW一个 native 和 h5 通讯的框架,支持调试
License: MIT License
一个 native 和 h5 通讯的框架,支持调试
License: MIT License
if (action == nil) {
return false;
}
SEL sel = nil;
if (paramDict == nil || paramDict.allKeys.count == 0) {
if (callbackKey.length == 0) {
sel = NSSelectorFromString([NSString stringWithFormat:@"%@", action]);
} else {
sel = NSSelectorFromString([NSString stringWithFormat:@"%@WithCallback:", action]);
}
} else {
if (callbackKey.length == 0) {
sel = NSSelectorFromString([NSString stringWithFormat:@"%@:", action]);
} else {
sel = NSSelectorFromString([NSString stringWithFormat:@"%@:callback:", action]);
}
}
if (![self respondsToSelector:sel]) {
return NO;
}
[self runSelector:sel withObjects:[NSArray arrayWithObjects:paramDict, callbackKey, nil]];
AHLog(@"agruments is %@",[NSArray arrayWithObjects:paramDict, callbackKey, nil]);
return YES;
这块的代码有点疑问?
这里定义的sel 跟参数是不是对不上, 当paramDict 定义为空且有callback的时候 sel为actionWithCallback:就一个参数 但是runSelector参数实际为两个造成exception。同理paramDict 为nil的时候 callback不为nil的时候NSArray arrayWithObjects:paramDict, callbackKey, nil]实际为空数组,也会有异常。
AppHostViewController+Scripts中的kAppHostCustomJavscripts初始化是在+ (void)prepareJavaScript:(id)script when:(WKUserScriptInjectionTime)injectTime key:(NSString *)key方法初始化的,而这个方法只有在AHDebugResponse的setupDebugger的方法中才会被调用,并且调用的代码做了#ifdef AH_DEBUG 宏判断,如果生产环境去掉AH_DEBUG的话,kAppHostCustomJavscripts则不会初始化,那么注入apphost.js、eval.js的injectScriptsToUserContent方法 则不会其效果,jsapi就无法注入了。建议将kAppHostCustomJavscripts的初始化代码挪出来。
第二个问题,自带的HTMLParser兼容性不太好,在我的工程中使用时候,我的WEB工程是用vuejs,生成的index.html里的script以及link标签无法识别,导致无法进行src的替换和文件内联。建议更换成Gumbo
请教一下,这个库的能力是不包含挂载到浏览器进行代码级别的调试的吧?
主要是日志打印和辅助信息展示,运行命令这些?
Hi,请问下Android端何时会开放上线呢?
目前我们计划采用该方案,苦于没有Android端。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.