账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    [ios] fireGlobalEvent无响应!写法是否有问。
    43
    0

    做一个二维码扫描功能

    在 appdelegate.m里初始化了 instance单例

    #import <UIKit/UIKit.h>
    #import <WeexSDK/WXSDKInstance.h>
    @interface AppDelegate : UIResponder <UIApplicationDelegate>
    
    @property (strong, nonatomic) UIWindow *window;
    @property (strong, nonatomic) WXSDKInstance *instance;
    @end

    注册了module 初始化instance

     self.instance = [[WXSDKInstance alloc] init];
     [WXSDKEngine registerModule:@"scanEvent" withClass:[WXScanModule class]];

    然后 module跳转扫描页面

    -(void)startScan{
    
        UIViewController *vc = [currentView getCurrentVC];
        ScanViewController *scan = [[ScanViewController alloc] init];
        
      [vc presentViewController:[[UINavigationController alloc] initWithRootViewController:scan] animated:YES completion:nil];
        
    }

    最后在 ScanViewController 发送 fireGlobalEvent 扫描出了东西 weex页面接受不到这个fireGlobalEvent …

    -(void)getScanDataString:(NSString*)scanDataString{
        
        NSLog(@"二维码内容:%@",scanDataString);
        AppDelegate *appDele = (AppDelegate *) [[UIApplication sharedApplication] delegate];
        [appDele.instance fireGlobalEvent:@"globalScan" params:@{@"scanInfo":scanDataString}];
     
        [self goBack];
    
    }

    大神们看看这个代码有啥问题啊~~

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 朱颜未换 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部