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.
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
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
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With