Skip to content
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

Pod error 'shared' is unavailable. use viewcontroller based solutions #288

Closed
fnrbh opened this issue Oct 11, 2017 · 34 comments
Closed

Pod error 'shared' is unavailable. use viewcontroller based solutions #288

fnrbh opened this issue Oct 11, 2017 · 34 comments

Comments

@fnrbh
Copy link

fnrbh commented Oct 11, 2017

Hello,
I followed the instructions on IOS sdk setup page. After 'pod install', i cleaned and built my project and got "'shared' is unavailable: Use view controller based solutions where appropriate instead" errors on my other pods.

When i remove onesignal from podfile and install, the errors disappear.
Anybody has seen this error?
thanks...

@jkasten2
Copy link
Member

@fnrbh Is this the full exact error?
Could you attach your Podfile contains so we can look into reproducing the issue?

@fnrbh
Copy link
Author

fnrbh commented Oct 12, 2017

@jkasten2 thank you for your response.

The error is : 'shared' is unavailable: use view controller based solutions where appropriate instead. TwitterPagerTabStripSettings.swift

My podfile is as follows:

 platform :ios, '9.0'

target 'mopa' do
  use_frameworks!

  # Pods for mopa
	pod 'Alamofire', '~> 4.4'
	pod 'FSPagerView'
	pod 'SDWebImage'
	pod 'SwiftKeychainWrapper'
	pod 'CHIPageControl', '~> 0.1.3'
	pod 'XLPagerTabStrip', :git => 'https://github.com/xmartlabs/XLPagerTabStrip.git'
	pod 'ActiveLabel'
	pod "Koloda"
	pod 'RxSwift',    '~> 3.0'
	pod 'RxCocoa',    '~> 3.0'
	pod 'RxDataSources', '~> 1.0'
	pod 'RxAlamofire'
	pod 'RSKImageCropper'
	pod 'OneSignal', '>= 2.5.2', '< 3.0'


  target 'mopaTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'OneSignalNotificationServiceExtension' do
  	pod 'OneSignal', '>= 2.5.2', '< 3.0'
  end	

end

@fnrbh fnrbh closed this as completed Oct 12, 2017
@fnrbh fnrbh reopened this Oct 12, 2017
@ahbou
Copy link

ahbou commented Oct 13, 2017

I have the same error when pods aren't extension compliant.
So far found 2 Siesta/UI and Quantcast

@fnrbh
Copy link
Author

fnrbh commented Oct 31, 2017

I solved the problems of other pods. I didn't use "shared" directly but used different ways to achieve the same result.

@fnrbh fnrbh closed this as completed Oct 31, 2017
@vanessaguapo
Copy link

i don't think this should have been closed. thats not a really solution, just a workaround. Anytime you update your pods, all your changes would be lost, otherwise one has to manually import all of the non compliant pods to the project itself.

@zachwhelchel
Copy link

Also seeing this error. Surely OneSignal doesn't expect all of your other pods to be extension compliant in order to use it?

@vanessaguapo
Copy link

I solved it the other way around and imported the OneSignal framework locally to the project. Since i have several pods that were not extension compliant, it was easier this way. But if there's an update i'll have to do it manually, so it's not a great solution, just a quick fix.

@black-lotus
Copy link

I am facing same issue..
has anybody solve this by cocoapods ?

@Komal2905
Copy link

I had same problem . So setting require only app-extension-safe api to No to other pod setting helped

@guoyingtao
Copy link

I had the same problem too.

@RishiRaj27
Copy link

RishiRaj27 commented Sep 17, 2018

Any one got the solution?
I am also getting the same error in my other pod files...

@Nightsd01
Copy link
Contributor

Nightsd01 commented Sep 17, 2018

Hi, we are planning to fix this - there is already an open issue for the app-extension-unsafe code (#396) and we will be addressing it by making our extension-specific code its own subspec framework.

In the mean time, setting the require only app-extension safe api in your Notification Service Extension's build settings should temporarily allow you to build.

Because there is already an issue for this I won't be reopening the ticket

@RishiRaj27
Copy link

Hi @Nightsd01 !
Thanks for your response. But the require only app-extension safe api in Notification Service Extension's build settings couldn't help me to resolve the error. Can you suggest me any thing else.

@vanessaguapo
Copy link

Hi @RishiRaj27 , i could't solve it that way either. As i said above I ended up importing the onesignal pod content to my project and using it inside instead of using a pod. Not an ideal solution, but it did the job.

@Nightsd01
Copy link
Contributor

@RishiRaj27 can you post your Podfile?

@RishiRaj27
Copy link

Thanks @Nightsd01 and @vanessaguapo !
I have followed these steps and got the solution.

  1. Download or clone thi repo.
  2. Drop and drag iOS_SDK/OneSignalSDK/Framework/OneSignal.framework into your Xcode project. Make sure to check the copy option.
  3. Add SystemConfiguration, UIKit, and UserNotifications to your framework list.
  4. You can then follow our full setup guide for the code setup.
  5. If you need the features provided by the Notification Service Extension you will need to repeat steps 2 and 3 above for this target.

@Nightsd01
Copy link
Contributor

@RishiRaj27 we have been working on a 3.0 release that will resolve this issue entirely. In the mean time manually including the framework should also resolve the problem

@ThakarRajesh
Copy link

ThakarRajesh commented Oct 25, 2018

@Nightsd01 i have import in manually in one signal notification but same error in shared' is unavailable: use view controller based solutions where appropriate instead then i have change require only app-extension safe api To NO then all issue resolved. any issue in upload in app store.

@rozeridilar
Copy link

rozeridilar commented Feb 22, 2019

I am having the same problem here, it happens whenever I add one signal in my OneSignalNotificationServiceExtension target

target 'OneSignalNotificationServiceExtension' do
pod 'OneSignal'
end

@ZakSingh
Copy link

ZakSingh commented Apr 4, 2019

Any update here? Running into the same issue and none of the provided fixes resolve the issue.

@dharmeshec5
Copy link

Any update here? Running into the same issue and none of the provided fixes resolve the issue.

Go to your App's target -> Build Setting -> Require Only AppExtension-Safe API -> set to NO
Error will disappear. It's worked for me. Good Luck!

Screenshot 2019-04-07 at 5 35 57 PM

@lukebrandonfarrell
Copy link

Hey All,

Flagging "Require Only App-Extension-Safe API" did not work for me. I solved this by putting the following code at the bottom of my Pods file:

...

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

Also, making sure my OneSignalNotificationServiceExtension target is a child of my app target:

target 'MyAwesomeApp' do
  ...


  target 'OneSignalNotificationServiceExtension' do
    pod 'OneSignal', '>= 2.9.3', '< 3.0'
  end
end

People still facing this issue? @ZakSingh @RishiRaj27 @vanessaguapo

@SogoGolf
Copy link

had this problem today too what a royal pain. thanks @lukebrandonfarrell that script saved having to manually update a bunch of pod files Build Settings.

@hugoh59
Copy link

hugoh59 commented Oct 15, 2019

None of these solutions works for me. The issue for me comes from React-Core.

@abhishek-gangwar
Copy link

Still facing the same issue with the Onesignal version (2.11.2). Using Xcode 11 and swift.

@wilz05
Copy link

wilz05 commented Nov 12, 2019

@abhishek-gangwar I too had similar issue spent 2 days to figure it out...ended by adding
use_frameworks! outside

for example

`platform :ios, '10.0'

use_frameworks!

target 'mopa' do
pod 'Alamofire', '~> 4.4'
pod 'FSPagerView'
pod 'SDWebImage'
pod 'OneSignal'

target 'mopaTests' do
inherit! :search_paths
end

target 'OneSignalNotificationServiceExtension' do
pod 'OneSignal'
end

end`

this should work, do not forget to update OneSignal SDK, it has the latest iOS13.2 notification bug fix

@danial096
Copy link

any better solution yet?

@Samuelford24
Copy link

@danial096 I had the same problem and solved it by removing additional pods that dealt with notifications. For example, I had OneSignal, Firebase Messaging, and Firebase InAppMessaging all in my podfile. I removed the 2 Firebase pods and then my project worked.

@danial096
Copy link

@Samuelford24 i dont have other pod that handle notification. The problem appear after I install onesignal pod to my notification extension. for now i just set
APPLICATION_EXTENSION_API_ONLY = NO. Hope can find a better solution soon

@lawgimenez
Copy link

It's 2020 and I just got this error today after setting up using Swift. The script worked.

@houmie
Copy link

houmie commented Jul 18, 2020

@lawgimenez I have the same issue. Which script worked for you?

@lawgimenez
Copy link

@houmie the one below sir, with the most upvotes

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

@houmie
Copy link

houmie commented Jul 19, 2020

@lawgimenez Thank you. I missed that somehow. That worked for me too.

@dnlsilva
Copy link

dnlsilva commented Oct 5, 2022

Hey All,

Flagging "Require Only App-Extension-Safe API" did not work for me. I solved this by putting the following code at the bottom of my Pods file:

...

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

Also, making sure my OneSignalNotificationServiceExtension target is a child of my app target:

target 'MyAwesomeApp' do
  ...


  target 'OneSignalNotificationServiceExtension' do
    pod 'OneSignal', '>= 2.9.3', '< 3.0'
  end
end

People still facing this issue? @ZakSingh @RishiRaj27 @vanessaguapo

Finally something that worked!!!
Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests