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

Swift Compiler Error (Xcode): No such module 'OneSignal' - ios/OneSignalNotificationServiceExtension/NotificationService.swift:2:7 #593

Open
nixonoftheyear opened this issue Aug 28, 2022 · 12 comments

Comments

@nixonoftheyear
Copy link

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.

  1. Quit Xcode.
  2. Delete project's temp files located at ~/Library/Developer/Xcode/DerivedData
  3. Delete ProjectName.xcworkspace
  4. flutter clean
  5. pod cache clean --all
  6. 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
  7. flutter pub get
  8. cd ios/
  9. pod install
  10. 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).

@binhitmobile
Copy link

Same issue!

@nixonoftheyear
Copy link
Author

nixonoftheyear commented Aug 30, 2022

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.

@emawby
Copy link
Contributor

emawby commented Sep 7, 2022

@binhitmobile Were you able to resolve this issue as well or are you still having problems?

@RennanAgroSmart
Copy link

I have the same problem.

@fahjan
Copy link

fahjan commented Oct 31, 2022

same problem here

@nixonoftheyear
Copy link
Author

@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.

@muhsinzyne
Copy link

is there any solutions @nixonoftheyear @emawby @nixonoftheyear @RennanAgroSmart @binhitmobile

am also stuck with the same for the last week.

@drav96
Copy link

drav96 commented Dec 27, 2022

Did anyone find a solution for this?

@jonyoung123
Copy link

jonyoung123 commented Aug 26, 2023

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.

@enricobenedos
Copy link

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.

@luckyhandler
Copy link

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

@shanky367
Copy link

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.

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