Closed jasonivers closed 5 years ago
Could you please include the full error? Or a screenshot?
Update: we have released version 3.4.0 that should fix this issue. If not, please comment and I will reopen. Cheers
Hi, @rgomezp . I have this error with 3.4.1 at the moment.
node_modules/react-native/React/DevSupport/RCTDevLoadingView.m:77:42: 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
Not sure if this applies to your library, but I’ll inform you
So.
OneSignalNotificationServiceExtension
is built successfully.OneSignalNotificationServiceExtension
with contents by default (without Onesignal imports)target 'OneSignalNotificationServiceExtension' do
pod 'OneSignal', '>= 2.9.3', '< 3.0'
end
and launched pod install
node_modules/react-native/React/DevSupport/RCTDevLoadingView.m:77:42: 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
System:
OS: macOS 10.14.6
CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
Memory: 11.75 GB / 32.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.16.1 - ~/.nvm/versions/node/v10.16.1/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.1/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
Android SDK:
API Levels: 23, 25, 27, 28, 29
Build Tools: 25.0.2, 25.0.3, 28.0.3, 29.0.1, 29.0.2
System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5791312
Xcode: 11.0/11A419c - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.5 => 0.60.5
└─ react-native-onesignal@3.4.1
@indapublic , Take a look at this stack overflow which may help. If any of the proposed solutions work for you, please comment here so we can close the ticket and help anyone else who may run into the problem: https://stackoverflow.com/questions/34225213/uiapplication-sharedapplication-not-available or https://stackoverflow.com/questions/32031071/error-sharedapplication-is-unavailable-not-available-on-ios-app-extension
Thanks, @rgomezp. I found that my podfile was wrong. I moved target "OneSignalNotificationServiceExtension" in wrong section yesterday. All works fine. Thank you and sorry. I can close this issue
@indapublic , Could you show how your podfile looked when it wasn't working? This will help people in the future if they make the same mistake
target 'app' do
target 'OneSignalNotificationServiceExtension' do
pod 'OneSignal', '>= 2.9.3', '< 3.0'
end
end
Don't have many experience with cocoapods yet, thought extensions were application dependent
Went through this exact same issue and like @indapublic did, I had added the extension to my Podfile incorrectly. Just wanted to add some clarity.
This issue arises when you add Service's target inside your app's target.
This is wrong:
target 'app' do
rn_path = '../node_modules/react-native'
....
target 'OneSignalNotificationServiceExtension' do
pod 'OneSignal', '>= 2.9.3', '< 3.0'
end
end
This is correct:
target 'app' do
rn_path = '../node_modules/react-native'
....
end
target 'OneSignalNotificationServiceExtension' do
pod 'OneSignal', '>= 2.9.3', '< 3.0'
end
This snippet needs to be its own top-level target and not a sub-target of your app.
Once corrected just run pod install
again.
Thanks, this fixed it for me too. I was under the impression that other answers suggested the opposite.
Went through this exact same issue and like @indapublic did, I had added the extension to my Podfile incorrectly. Just wanted to add some clarity.
This issue arises when you add Service's target inside your app's target.
This is wrong:
target 'app' do rn_path = '../node_modules/react-native' .... target 'OneSignalNotificationServiceExtension' do pod 'OneSignal', '>= 2.9.3', '< 3.0' end end
This is correct:
target 'app' do rn_path = '../node_modules/react-native' .... end target 'OneSignalNotificationServiceExtension' do pod 'OneSignal', '>= 2.9.3', '< 3.0' end
This snippet needs to be its own top-level target and not a sub-target of your app.
Once corrected just run
pod install
again.
Thanks, Man Save My Day.
Description: Adding the target OneSignalNotificationServiceExtension causes my app to be unable to build, due to being unable to use certain things in app extensions... in this case, the error is specifically about sharedApplication (it actually shows up as a problem in RCTRedBox.m). The app builds fine, even with react-native-onesignal, until I add the extension.
Environment react-native-onesignal: 3.3.3 react-native: 0.59.9
SDK added via yarn, then react-native link react-native-onesignal
Steps to Reproduce Issue:
I haven't had the time to attempt to reproduce in an app other than mine... On my app (so presumably others?):
Install SDK via yarn Link package pod install Add extension following instructions from https://documentation.onesignal.com/docs/react-native-sdk-setup#section-usage Attempt to build
Anything else:
All in the description