标签:执行 lua str back eval err mst return app
我们这边和h5商量好传递一个结构体参数过去,然后由于解析的问题,导致我这里传递的参数,到h5那边不执行那边的方法
-(void)loginCallBack
{
NSDictionary *dic;
user = [IBKeychain loadValueForKey:kUserKey];
if (user) {
dic= @{
@"id":[user objectForKey:@"userId"],
@"token":[user objectForKey:@"access_token"],
@"appTag":@"IOS"
};
}else{
dic= @{
// @"id":@"",
@"token":@"",
@"appTag":@"IOS"
};
}
NSData *jsonData = [NSJSONSerialization
dataWithJSONObject:dic options:0
error:nil];
NSString *result = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSString *jsStr = [NSString stringWithFormat:@"appLoginCallBack(‘%@‘);",result];
[self.webView stringByEvaluatingJavaScriptFromString:jsStr];
// return;
}
然后这样就可以调用方法了
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
[self hideLoadingView];
[self loginCallBack];
}
标签:执行 lua str back eval err mst return app
原文地址:http://www.cnblogs.com/huiyi-520/p/6289228.html