按照官网所描述的步骤
新建SelfModule.m/.h文件,并导入project-swift.h,对外定义暴露jumpNextPage(params : String)方法
#import "SelfModule.h"
#import "Project-Swift.h"
#import "Project-Bridging-Header.h"
@implementation SelfModule
#pragma clang diagnostic push //关闭unknow selector的warrning
#pragma clang diagnostic ignored "-Wundeclared-selector"
@synthesize weexInstance;
WX_EXPORT_METHOD(@selector(jumpNextPage))
#pragma clang diagnostic pop
@end
新建SelfModule.swift文件,扩展SelfModule方法
public extension SelfModule{
public func jumpNextPage(params : NSString){
let controller = UIViewCtroller()
weexInstance.viewController.navigationController?.pushViewController(controller, animated:true)
}
}
在AppDelegate中注册Module,
WXSDKEngine.registerModule("self_module", with: NSClassFromString("SelfModule"))
结果提示
method:jumpNextPage for module:self_module doesn't exist, maybe it has not been registered [;
在Android上是没有任何问题的,但是在iOS上报错,求解原因