iOS Build error - 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
Hi I know something similar to this has been discussed in the past but none of the fixes I've found seem to hold an answer!
Whenever I build my app I see the error in the RCTKeyCommans.m file: 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
System Info:
RN: 0.64.2 React: 17.0.2 XCode: 13.1 macOS: 11.6
The share extension has been working without issue and a recent RN upgrade (0.63 => 0.64) has seemingly broken it.
The podfile has the following added:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
end
end
end
and target for the share extension is like so:
target 'myShareExtension' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => false
)
pod 'RNShareMenu', :path => '../node_modules/react-native-share-menu'
end
Any advice would be appreciated!
Me too , there is no good way
I did get this to work in the end.
I had further commands in the target.build_configurations.each do |config| loop and the important thing to note is that the APPLICATION_EXTENSION_API_ONLY has to be 1st.
Still having this issue.. any news on this?
In my case, I have included ReactShareViewController.swift except ShareViewController.swift , so thats solved my build issue