Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] 如何获得小程序的VC,自定义转场等 #18

Closed
ShawnFoo opened this issue Sep 8, 2019 · 2 comments
Closed

[iOS] 如何获得小程序的VC,自定义转场等 #18

ShawnFoo opened this issue Sep 8, 2019 · 2 comments

Comments

@ShawnFoo
Copy link

ShawnFoo commented Sep 8, 2019

  • 小程序版本: 10.1.60

目前仅发现如下方式直接打开小程序, 是否有更灵活的方式操作小程序的容器VC

[MPNebulaAdapterInterface startTinyAppWithId:appId params:dic];

使用以下方式打开Demo中小程序的内置离线包,会一直报错底部的错误

NSString *appId = @"2017072607907880";
UIViewController *vc =
[[MPNebulaAdapterInterface shareInstance] createH5ViewControllerWithNebulaApp:@{
                                                                                @"appId": appId,
                                                                                @"chInfo" : @"MPPortal_home"
                                                                                }];
[self.navigationController pushViewController:vc animated:YES];

[mPaaSTinyApp] H5_JSC_Execute_Error:{
logStr = "ReferenceError: Can't find variable: window{\n "line": 1,\n "column": 10,\n "sourceURL": "https://error.alipay.com/\"\n}";
}

@vivi23vivi
Copy link

上述createH5ViewControllerWithNebulaApp目前暂不支持基于小程序创建vc,下个版本会修复。
您可以使用以下方法,基于小程序创建一个viewcontroller
[[NBServiceGet() appCenter] prepareApp:@"2017072607907880" version:nil process:^(NAMAppPrepareStep step, id info) {
} finish:^(NAMApp *app, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{
UIViewController *vc = [H5Service createWebViewController:@{@"appId": app.app_id,@"version":app.version} JSApis:nil withDelegate:nil];
[self.navigationController pushViewController:vc animated:YES];
});
}];

@ShawnFoo
Copy link
Author

稳!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants