Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No such module 'OneSignal'

I'm trying to integrate OneSignal SDK in Xcode 7.2.1 with CocoaPods 1.0.0.beta.2 and use_frameworks! directive. When I try to import the framework in AppDelegate.swift I get

No such module 'OneSignal'.

I also have other frameworks included from Cocoapods which work with no problem (ex: Fabric)

I managed to install OneSignal SDK with cocoapods in another project, but without the use_frameworks! directive. I used the bridging header.

like image 581
Mihai Avatar asked Feb 05 '16 08:02

Mihai


4 Answers

Pods written in Swift can be imported with the use_frameworks!, and CocoaPods will complain if you don't do this and try to import the pods in Swift code.

Although any pods not written in Swift, will require the use of a bridging header.

Referencing to the OneSignal pod, the getting-started guide instructs applications using Swift to include a bridging header in order to use the pod. OneSignal: Getting Started Guide

like image 181
Ollie Avatar answered Sep 19 '22 21:09

Ollie


You need to type these commands. It has fixed it for me:

$ pod deintegrate
$ pod install

My Podfile:

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

target 'Your_Project_Name' do
  # Comment the next line if you don't want to use dynamic frameworks

  # Pods for Das Gedenken
pod 'OneSignal'


end

target 'OneSignalNotificationServiceExtension' do
  #only copy below line
  pod 'OneSignal'
end
like image 33
SwiftiSwift Avatar answered Sep 18 '22 21:09

SwiftiSwift


if you have already pod file before starting development OneSignal, you need to add new target for OneSignalNotificationServiceExtension.

    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

After the adding above code to the podfile. You must "pod install" one again.

like image 25
Emre Gürses Avatar answered Sep 20 '22 21:09

Emre Gürses


Another thing to mention is that Getting error "No such module" using Xcode, but the framework is there

If the framework header is already included in the bridging header file then you don't have to import it in the Swift source file.

like image 31
onmyway133 Avatar answered Sep 17 '22 21:09

onmyway133