Skip to content

Commit

Permalink
Fix removed method in SimDeviceNotifier
Browse files Browse the repository at this point in the history
  • Loading branch information
fr0l committed Jul 16, 2019
1 parent dc9d279 commit 4fdc14f
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions FBSimulatorControl/Notifiers/FBCoreSimulatorNotifier.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,22 @@ - (instancetype)initWithNotifier:(id<SimDeviceNotifier>)notifier queue:(dispatch
}

_notifier = notifier;
_handle = [notifier registerNotificationHandler:^(NSDictionary *info) {
dispatch_async(queue, ^{
block(info);
});
}];

BOOL isNewApi = [(NSObject *)notifier respondsToSelector:@selector(registerNotificationHandlerOnQueue:handler:)];

if (isNewApi) {
_handle = [notifier registerNotificationHandlerOnQueue:queue handler:^(NSDictionary *info) {
dispatch_async(queue, ^{
block(info);
});
}];
} else {
_handle = [notifier registerNotificationHandler:^(NSDictionary *info) {
dispatch_async(queue, ^{
block(info);
});
}];
}

return self;
}
Expand Down

0 comments on commit 4fdc14f

Please sign in to comment.