-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Version 0.40.0 gives 12 issues in xcode #11736
Comments
Maybe some modules are affected by this? |
No modules, I get this straight from initializing the project, so it's clean. No code changed, no modules, nothing. This is the files originally created. |
Those are warning and you can mostly ignore those warning. You project should run fine with those warning. |
It would be great if someone can send a PR to fix those warning, from the screenshot it seems pretty straightforward. |
also these problems? when i use 0.40, some third packages are wrong |
For the RCT_EXTERN void RCTExecuteOnMainThread(dispatch_block_t block, BOOL sync)
__deprecated_msg("Use RCTExecuteOnMainQueue instead. RCTExecuteOnMainQueue is "
"async. If you need to use the `sync` option... please don't."); the two uses that are generating warnings are in // RCTUtils.m
CGFloat RCTScreenScale()
{
static CGFloat scale;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
RCTExecuteOnMainThread(^{
scale = [UIScreen mainScreen].scale;
}, YES);
});
return scale;
}
CGSize RCTScreenSize()
{
// FIXME: this caches the bounds at app start, whatever those were, and then
// doesn't update when the device is rotated. We need to find another thread-
// safe way to get the screen size.
static CGSize size;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
RCTExecuteOnMainThread(^{
size = [UIScreen mainScreen].bounds.size;
}, YES);
});
return size;
} I understand why we don't want to make synchronous calls on the main thread. Is this an exception? Would the preferred approach be to dispatch directly from these two functions instead of using the deprecated function? Or is the solution to refactor all callers to handle an asynchronous method signature? |
In this case we might want to silence the warning since there isn't an alternative to this. |
Another option (maybe better) would be to create |
Thanks for the info @janicduplessis. It's 2am in Portugal so I'm gonna call it for tonight but will implement this suggestion and submit tomorrow, although I'm not sure the issue will still be there by then judging by the trajectory @rh389 is on with these warnings :) |
Haha I'm also about to call it a night (UK) - I'll leave the Some progress though - if these go through it's 8 down, 4 to go. |
Thanks a lot for working on this :) |
Summary: As per janicduplessis recommendation, provide a new synchronous method to replace the necessary synchronous calls and use a warning in the comments (and method name). **Motivation** There are currently a number of XCode warnings that show up in a fresh 0.40 install of a react native project. While the project can still be run, this contributes negatively to the development experience -- valid warnings may be ignored and new ones may be added as per https://en.wikipedia.org/wiki/Broken_windows_theory This addresses one of the warnings, by providing the functionality of a deprecated method in two specific cases where we can't avoid doing synchronous work on the main queue. See #11736 for more context. **Test plan (required)** I ran a project that relied on screen size and it didn't crash...happy to do more involved testing if someone can share better methodology. Closes #11817 Differential Revision: D4402911 fbshipit-source-id: 9fd8b3f50d34984b765fe22b1f4512e103ba55a9
Summary: **Motivation** This finishes the job of #11817, removing the previously deprecated method. See #11736 for more context. **Test plan** There were no tests for this method, and I searched the whole project to make sure we weren't relying on it anywhere. Closes #11854 Differential Revision: D4421671 Pulled By: javache fbshipit-source-id: 67e0db8d3c594ad3ccd6ccdae08f8ce49ddb8a34
Summary: **Motivation** This finishes the job of facebook#11817, removing the previously deprecated method. See facebook#11736 for more context. **Test plan** There were no tests for this method, and I searched the whole project to make sure we weren't relying on it anywhere. Closes facebook#11854 Differential Revision: D4421671 Pulled By: javache fbshipit-source-id: 67e0db8d3c594ad3ccd6ccdae08f8ce49ddb8a34
Ok so in latest release, 0.41 warnings are still there. |
Most of them are fixed in master, I think these commits didn't make it to 0.41 sadly. You can just ignore them. |
@janicduplessis I'd appreciate your thoughts on the last one remaining (last I checked). The messy part is that this would diverge from the way Android emits the same events. AFAIK Android has no similar mechanism for module emitters and everything's global there. So the listening side, Dimensions , for example, would have to fork by platform, and must be aware of If global events are genuinely deprecated (ie, will be removed) in iOS then this is something we've just got to do, and hopefully Android will catch up some day. If global events are going to hang around for a while yet, we might be better suppressing this warning until there's an Android equivalent. Or do we just take the plunge now and accept a bit of inconsistency? |
Hey, @rh389, @janicduplessis does this seem sensible? |
@janicduplessis I'm still getting very similar errors in |
@janicduplessis If I sent a pull request to remove all of these deprecation warnings, how long might it take for that to be accepted? (I noticed there's an enormous number of issues and pull requests, so I'm worried about wasting my time if it never gets any attention.) |
I think the only outstanding deprecation already has a PR #12209. Many of the unused param warnings only appear in release builds because they're due to debug checks that get preprocessed away. I guess it should be possible to suppress that warning via a compiler setting for release only. |
@rh389 Ah great, thanks. Yeah that would be great if they could be suppressed. There's a lot of noise when I build the project in Xcode, and I have to scroll down a long way to see the actual errors. |
@ndbroadbent, you can actually filter to show only errors and not warnings in XCode. It's the second icon on the right. |
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally! If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution. |
This issue is still valid, actually, I got closer to 100 warnings and a couple of "Logic errors" - from a fresh install! Those are noisy when trying to develop native components. @rh389 said many where due to automatic release pre-processing. To suppress these warning - ONLY ON THE REACT STUFF - ie. not on your own code; change build settings for the relevant targets: https://stackoverflow.com/questions/7997636/disable-warnings-in-xcode-from-frameworks for the logic errors; see "-Xanalyzer -analyzer-disable-all-checks" |
Please give |
Straight from init a new project and opening it with Xcode and running it in the iOS simulator I get 12 issues in Xcode, and this is without changing any code.
Did not get any issues with version 0.39.0
––––––––––––––––––––––––––––––
The text was updated successfully, but these errors were encountered: