Closed rsml closed 4 years ago
My coworker suggested this change:
In RNQuickActionManager.m
Change:
RCT_EXPORT_METHOD(setShortcutItems:(NSArray *) shortcutItems)
{
NSArray *dynamicShortcuts = [self dynamicShortcutItemsForPassedArray:shortcutItems];
[UIApplication sharedApplication].shortcutItems = dynamicShortcuts;
}
To:
RCT_EXPORT_METHOD(setShortcutItems:(NSArray *) shortcutItems)
{
dispatch_async(dispatch_get_main_queue(), ^{
NSArray *dynamicShortcuts = [self dynamicShortcutItemsForPassedArray:shortcutItems];
[UIApplication sharedApplication].shortcutItems = dynamicShortcuts;
});
}
@rsml great! Would you be willing to put this together in a PR?
@jordanbyron Sure thing. I submitted a pull request.
Thanks @rsml
I have an app where on iOS it opens in response to clicking a universal link. Then I immediately call setShortcutItems().
I get this warning in the console, but no crash:
I'm calling setShortcutItems() from inside javascript so I'm not sure what's causing it to run on a background thread.
I'm thinking you might need to add a
Dispatch.main.async
on iOS for cases when it's running in a background thread.