| | |
| ----------- | --- |
| Version | 17.3 |
| Affected OS | ios |
| OS Version | 11.2 |
When using react-native-device-info in an iOS App Extension it fails to build because sharedApplication is referenced once RNDeviceInfo.m:207:
'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
Would love for it to be able to build. And since it's only one line I'm guessing it could be potentially simple. Not an Objective-C pro though - so I don't know how! :)
Thank you for logging this issue! Not an objective-c guy neither, so any help would be appreciated :)
There's no way to do this automatically that I know of. You need an #ifdef around it, something like:
#ifndef APP_EXTENSION
// Reference sharedApplication here
#endif
and then document for users the need to add this define to their build settings, typically in XCode in "Custom Compiler Flags" for that target:
#define APP_EXTENSION YES
I'm working on an app that has an extension in it, but won't be touching the extension for another week or two. If this issue is still open when I get around to that module, I'll try to submit a PR for it.
This may be fixed shortly - has a PR in feedback stage
Most helpful comment
This may be fixed shortly - has a PR in feedback stage