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

Crash in run xcode10.1 #135

Closed
su350380433 opened this issue Apr 22, 2019 · 3 comments
Closed

Crash in run xcode10.1 #135

su350380433 opened this issue Apr 22, 2019 · 3 comments

Comments

@su350380433
Copy link

+ (instancetype)allocWithZone:(struct _NSZone *)zone{
    UIViewController *viewController = [super allocWithZone:zone];
    @weakify(viewController)
    [[viewController
      rac_signalForSelector:@selector(viewDidLoad)]
     subscribeNext:^(id x) {
         @strongify(viewController)
        [viewController performSelector:@selector(bindViewModel) withObject:nil afterDelay:0];
     }];
    return viewController;
}

- (void) injected {
    [self viewDidLoad];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor redColor];
    [self bindViewModel];
}

- (void)bindViewModel{
    @weakify(self);
    [self.mobileField.rac_textSignal subscribeNext:^(NSString * _Nullable x) {
        @strongify(self);
        NSLog(@"%@",x);
    }];
}

pod ReactiveObjC 。Run this code will crash。ask for help

@su350380433
Copy link
Author

@johnno1962
Copy link
Owner

Thanks for the information on your crash. Last time I checked it’s not possible to use InjectionIII with ReactiveObjC as it uses __unsafe_unretained pointers which can be deallocated when injection does it’s “sweep” which implements the - (void)injected functionality. The alternative is to subscribe to the “INJECTION_BUNDLE_NOTIFICATION” notification.

@su350380433
Copy link
Author

Thank you for your quick reply

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