8

I have an issue with OneSignal module. It keeps giving me No such module OneSignal and I installed it by cocoa pods and have use_frameworks! in my pod file. I really have no clue what else I should configure to make it work

I tried other solutions here like:

Getting error No such module using Xcode, but the framework is there

enter image description here

enter image description here

pod file

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

target 'Jaee2' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Jaee2


pod 'OneSignal', '>= 2.5.2', '< 3.0'
end

target 'OneSignalNotificationServiceExtension' do
 use_frameworks!

  pod 'OneSignal', '>= 2.5.2', '< 3.0'
end
AlmoDev
  • 969
  • 2
  • 18
  • 46
  • While a link to external resources is ok, it would probably be better to briefly list what you have tried directly in your post to not force others to follow links in order to understand what you've done. – Maciej Jureczko Sep 27 '17 at 23:55

2 Answers2

5

Are you seeing the same error in AppDelegate as well when you import OneSignal there? If no, ensure that in your pod file you added pod 'OneSignal', '>= 2.5.2', '< 3.0' for the target OneSignalNotificationServiceExtension. So your pod file should look like:

target 'OneSignalNotificationServiceExtension' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for OneSignalNotificationServiceExtension
pod 'OneSignal', '>= 2.5.2', '< 3.0'

end

target 'test' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for test
pod 'OneSignal', '>= 2.5.2', '< 3.0'

end
Ali
  • 481
  • 3
  • 16
  • I did that at first in my pod file can you check my pod file in my question please – AlmoDev Sep 28 '17 at 05:49
  • can you share what are the steps you followed? cz I followed the steps mentioned here, https://documentation.onesignal.com/docs/ios-sdk-setup , and i dint face any issue. – Ali Sep 28 '17 at 09:20
  • Thank you I just solved it and now I'm facing another issue with `sharedApplication is unavailable: not available in ios app extension - Use view controller based solutions where appropriate instead`Any idea why this issue came up once OneSignal was solved ? – AlmoDev Sep 28 '17 at 09:32
  • Cocoapods are very useful (I'm sure), however they are designed to work with Apps, not App Extensions, and ultimately you lose control of the features they introduce during an update, so you will need to be more judicial about what versions of libraries you do use, based on the APIs they utilize. So maybe you should try downgrading the version or setting a fixed version. Reference: https://stackoverflow.com/questions/32031071/error-sharedapplication-is-unavailable-not-available-on-ios-app-extension – Ali Sep 28 '17 at 14:27
  • your question solved my problem ..because i didn't add onesignal to extension :))) – Mehrdad Dec 18 '17 at 13:26
1

If you dont want use cocoapods. Swift Package Manager available.

Swift Package Manager

Asil ARSLAN
  • 1,066
  • 2
  • 14
  • 31