alipay / mPaaS

mPaaS Demo 合集,mPaaS 是源自于支付宝的移动开发平台。The collection of demos for mPaaS components. mPaaS is the Mobile Development Platform which oriented from Alipay.
https://tech.antfin.com/docs/2/49549
Apache License 2.0
324 stars 55 forks source link

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

Closed ShawnFoo closed 4 years ago

ShawnFoo commented 4 years ago

目前仅发现如下方式直接打开小程序, 是否有更灵活的方式操作小程序的容器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 commented 4 years ago

上述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 commented 4 years ago

稳!