OneSignal-Flutter-SDK
OneSignal-Flutter-SDK copied to clipboard
Swift Compiler Error (Xcode): No such module 'OneSignal' - ios/OneSignalNotificationServiceExtension/NotificationService.swift:2:7
Description: I don't know if this issue is related for the update of XCode 13.4.1 but the error of OneSignal during the build for the iOS with Flutter Framework are very often and we lose many days investigating them.
In a nutshell it is no longer possible to build for iOS having OneSignal as a dependency. Given that OneSignal is correctly configured, it has always worked (apart from several cases since it has been integrated into our project). I can't figure out if there is any new configuration to add given the XCode 13.4.1 or onesignal_flutter: ^3.4.1 update or if there is something additional to add elsewhere. I don't know why the useful changelog panel in pub.dev is not used for onesignal_flutter dependency. Is very useful for us since all the others use it and we can at a glance intercept some required changes.
Below is the output produced by the flutter build ipa
command that reports the OneSignal error.
Archiving ...
Automatically signing iOS for device deployment using specified development team in Xcode project: XXXXXXX
Running Xcode build...
Xcode archive done. 5,2s
Failed to build iOS app
Error output from Xcode build:
↳
2022-08-28 16:29:47.980 xcodebuild[1247:10476] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension
Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-08-28 16:29:47.980 xcodebuild[1247:10476] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension
Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
** ARCHIVE FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/xp/129pjhld5197lldlypg_6pn40000gn/T/flutter_tools.9LNa3X/flutter_ios_build_temp_dir4wmQE2/temporary_xcresult_bundle
/Users/XXXXXX/Documents/workspace-flutter/XXXXXX/ios/OneSignalNotificationServiceExtension/NotificationService.swift:3:8: error: no such module 'OneSignal'
import OneSignal
^
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
/Users/XXXXXX/Documents/workspace-flutter/XXXXXX/ios/OneSignalNotificationServiceExtension/NotificationService.swift:3:8: error: no such module 'OneSignal'
import OneSignal
^
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Result bundle written to path:
/var/folders/xp/129pjhld5197lldlypg_6pn40000gn/T/flutter_tools.9LNa3X/flutter_ios_build_temp_dir4wmQE2/temporary_xcresult_bundle
Swift Compiler Error (Xcode): No such module 'OneSignal'
/Users/XXXXXX/Documents/workspace-flutter/XXXXXX/ios/OneSignalNotificationServiceExtension/NotificationService.swift:2:7
Encountered error while archiving for device.
Environment XCode 13.4.1 onesignal_flutter: ^3.4.1 Podifle I have this section:
target 'OneSignalNotificationServiceExtension' do
use_frameworks!
pod 'OneSignalXCFramework', '>= 3.4.3', '< 4.0'
end
I've tried a very clean installation but the error still the same.
- Quit Xcode.
- Delete project's temp files located at ~/Library/Developer/Xcode/DerivedData
- Delete ProjectName.xcworkspace
- flutter clean
- pod cache clean --all
- rm ios/Podfile.lock rm -rf ios/Pods rm -rf ios/.symlinks ios/Flutter/App.framework ios/Flutter/Flutter.framework ios/Flutter/Flutter.podspec rm -rf ~/.cocoapods/repos
- flutter pub get
- cd ios/
- pod install
- pod update
Steps to Reproduce Issue:
Launch the command
flutter build ipa
with all updated (dependency in pubspec.yaml, XCode 13.4.1, 'OneSignalXCFramework', '>= 3.4.3', '< 4.0' in Podfile).
Same issue!
After several days I solved it by deleting Runner.xcodeproj and Runner.xcworkspace and recreating the structure with
flutter create .
command launched in the root of the project.
Configuring the new and fresh Runner.xcodeproj following the guide on OneSignal Flutter SDK 'Add an iOS Service Extension'.
Inside the Runner.xcodeproj I saw that several things have changed compared to previous versions, especially the paths of the framework reference in the Build Settings and the name of the Pod from OneSignal to OneSignalXCFramework.
After, launch pod install
for creating Runner.xcworkspace
This solution also depends a lot on the other dependencies your project has.
Mine was a project created two years ago and that I am keeping, probably many things have changed but on the OneSignal site there is no guide to support a migration like in my case.
@binhitmobile Were you able to resolve this issue as well or are you still having problems?
I have the same problem.
same problem here
@oussemaRidene it's incorrect. for many other dependencies the minimum iOS version must be 11.0 (or a higher value) so it's not possible and conceptually incorrect to downgrade.
is there any solutions @nixonoftheyear @emawby @nixonoftheyear @RennanAgroSmart @binhitmobile
am also stuck with the same for the last week.
Did anyone find a solution for this?
I've found a fix: In your NotificationService.swift file, instead of "import OneSignal" do "import OneSignalFramework".
This worked for me in my flutter project.
I think that a good idea is to vote the main issue and not the comments of other people that say "same issue", anyway it happens also moving from the new SDK at version 5.
import OneSignalFramework
This seems to be a documentation problem here https://documentation.onesignal.com/docs/flutter-sdk-setup#ios-devices
Please fix this if the mentioned fix is the real fix
import OneSignalFramework
Not working getting multiple commands .
Followed steps from official documentation from OneSignal but not working for iOS Xcode version: 14.3.1 Flutter Code Base Can some please provider suggestion or alternate way to achieve notification.