UIApplication methods should only be called from the main thread (PR #413)

This commit is contained in:
Chris Bianca 2017-09-22 08:53:46 +01:00
parent a773a3ec49
commit 8d52b773f1
2 changed files with 6 additions and 2 deletions

View File

@ -16,7 +16,9 @@ RCT_EXPORT_METHOD(setAnalyticsCollectionEnabled:(BOOL) enabled) {
}
RCT_EXPORT_METHOD(setCurrentScreen:(NSString *) screenName screenClass:(NSString *) screenClassOverriew) {
[FIRAnalytics setScreenName:screenName screenClass:screenClassOverriew];
dispatch_async(dispatch_get_main_queue(), ^{
[FIRAnalytics setScreenName:screenName screenClass:screenClassOverriew];
});
}
RCT_EXPORT_METHOD(setUserId: (NSString *) id) {

View File

@ -386,7 +386,9 @@ RCT_EXPORT_METHOD(getScheduledLocalNotifications:(RCTPromiseResolveBlock)resolve
}
RCT_EXPORT_METHOD(setBadgeNumber: (NSInteger*) number) {
[RCTSharedApplication() setApplicationIconBadgeNumber:number];
dispatch_async(dispatch_get_main_queue(), ^{
[RCTSharedApplication() setApplicationIconBadgeNumber:number];
});
}
RCT_EXPORT_METHOD(getBadgeNumber: (RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {