防止遗忘,简单记录下。
//H5
if (
('undefined' != typeof(window.Android) &&
null != window.Android &&
'undefined' != typeof(window.Android.joinConfereanceWithConferId) &&
null != window.Android.joinConfereanceWithConfRoomMarkPassword
) || (
'undefined' != typeof(window.LINKCAREIOS) &&
null != window.LINKCAREIOS &&
'undefined' != typeof(window.LINKCAREIOS.joinConfereanceWithConferId) &&
null != window.LINKCAREIOS.joinConfereanceWithConfRoomMarkPassword
)
) {
$(".mui-btn-warning").on("tap", function() {
event.stopPropagation();
var ua = navigator.userAgent.toLowerCase();
if (/android/.test(ua)) { //安卓
window.Android.joinConfereanceWithConfRoomMarkPassword(tempConf.conferid,'password');
} else if (/iphone/.test(ua) || /ipad/.test(ua)) { //苹果
window.LINKCAREIOS.joinConfereanceWithConfRoomMark(tempConf.conferid,tempConf.psw);
}
});
} else {
//非手机点击
$(".mui-btn-warning").on("tap", function() {
event.stopPropagation();
alert('非手机点击加入会议,conferid='+tempConf.conferid);
});
}
//IOS
#import <JavaScriptCore/JavaScriptCore.h>
@protocol SchedeleJSObjDelegate <JSExport>
- (void)joinConfereanceWithConfRoomMark: (NSString *)conferRoomMark Password:(NSString *)psw;
@end
- (void)webViewDidFinishLoad:(UIWebView *)webView{
//首先创建JSContext 对象(此处通过当前webView的键获取到jscontext)
[MBProgressHUD hideHUDForView:self.view animated:YES];
self.jsContext = [webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
self.jsContext[@"LINKCAREIOS"] = self;
self.jsContext.exceptionHandler = ^(JSContext *context, JSValue *ex){
context.exception = ex;
NSLog(@"异常信息%@",ex);
};
}
- (void)joinConfereanceWithConfRoomMark: (NSString *)conferRoomMark Password:(NSString *)psw{
网友评论