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

[Bug]: No Module Found "OneSignalExtension" in NotificationService.swift #857

Open
2 of 3 tasks
asadamatic opened this issue Mar 20, 2024 · 5 comments
Open
2 of 3 tasks

Comments

@asadamatic
Copy link

What happened?

I followed this Flutter SDK setup guide. I used the provided swift code and my iOS build kept failing after it. I rebuilt my app using XCode, and it gave me this error in the NotificaitonService swift file.

Steps to reproduce?

1. Use the code provided in the Flutter SDK Setup guide for the `NotificationService` swift file.
2. Try building the Flutter app for iOS normally, and it will fail without providing much information.
3. Build the app using XCode.

What did you expect to happen?

I expected the code from the official guide to work without any issues.

OneSignal Flutter SDK version

Release 5.1.2

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

OneSignalNotificationServiceExtension
/Users/user/AndroidStudioProjects/shopify_app/ios/OneSignalNotificationServiceExtension/NotificationService.swift
/Users/user/AndroidStudioProjects/shopify_app/ios/OneSignalNotificationServiceExtension/NotificationService.swift:45:8 No such module 'OneSignalExtension'

flutter_local_notifications
/Users/user/.pub-cache/hosted/pub.dev/flutter_local_notifications-16.3.3/ios/Classes/FlutterLocalNotificationsPlugin.m
/Users/user/.pub-cache/hosted/pub.dev/flutter_local_notifications-16.3.3/ios/Classes/FlutterLocalNotificationsPlugin.m:6:17 Method definition for 'setRegisterPlugins:' not found

flutter_local_notifications-flutter_local_notifications_privacy
/Users/user/AndroidStudioProjects/shopify_app/ios/Pods/Pods.xcodeproj The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 17.4.99.

onesignal_flutter
/Users/user/.pub-cache/hosted/pub.dev/onesignal_flutter-5.1.2/ios/Classes/OneSignalPlugin.m
/Users/user/.pub-cache/hosted/pub.dev/onesignal_flutter-5.1.2/ios/Classes/OneSignalPlugin.m:58:16 Null passed to a callee that requires a non-null argument

/Users/user/.pub-cache/hosted/pub.dev/onesignal_flutter-5.1.2/ios/Classes/OSFlutterInAppMessages.m
/Users/user/.pub-cache/hosted/pub.dev/onesignal_flutter-5.1.2/ios/Classes/OSFlutterInAppMessages.m:104:47 Incompatible pointer types sending 'OSFlutterInAppMessages *' to parameter of type 'NSObject<OSInAppMessageClickListener> * _Nullable'

/Users/user/.pub-cache/hosted/pub.dev/onesignal_flutter-5.1.2/ios/Classes/OSFlutterPushSubscription.m
/Users/user/.pub-cache/hosted/pub.dev/onesignal_flutter-5.1.2/ios/Classes/OSFlutterPushSubscription.m:33:17 Method definition for 'sharedInstance' not found

/Users/user/.pub-cache/hosted/pub.dev/onesignal_flutter-5.1.2/ios/Classes/OSFlutterUser.m
/Users/user/.pub-cache/hosted/pub.dev/onesignal_flutter-5.1.2/ios/Classes/OSFlutterUser.m:91:35 Incompatible pointer types sending 'NSDictionary *' to parameter of type 'NSArray<NSString *> * _Nonnull'

/Users/user/.pub-cache/hosted/pub.dev/onesignal_flutter-5.1.2/ios/Classes/OSFlutterUser.m:103:32 Incompatible pointer types sending 'NSDictionary *' to parameter of type 'NSArray<NSString *> * _Nonnull'

OneSignalXCFramework
/Users/user/AndroidStudioProjects/shopify_app/ios/Pods/Pods.xcodeproj The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@markosole
Copy link

I am having same issue, with error on Podfile import:

import UserNotifications

import OneSignalExtension    // < Shows error No such modlue 'OneSignalExtension'
// rest of the swift code...

I am using Xcode version 14.1 and flutter version 3.19.6 with Dart 3.3.4. I have repeated steps 3 times following guide. Only thing that isn't available in this Xcode is "Minimum Deployments" for iOS version. There is only "Deployment Target".

@asadamatic have you managed to get it working?

@elishae621
Copy link

I am having the exact same problem. @markosole have you found a solution?

@markosole
Copy link

markosole commented May 12, 2024

Hi @elishae621 yes I have manged to sort it out and it works now. There are few things that I did:

  • Set your pubspec.xml to lates version of flutter onesignal package onesignal_flutter: ^5.1.6
  • Update MacOS and XCode to latest versions available (XCode 15.3) and latest MacOS is requirement
  • Delete ios folder (or rename if you need something from it)
flutter clean
flutter pub get
  • Prepare your Runner project by following procedure from OneSignal docs
    NOTE: Pay attention on step when you have to navigate in /ios drectory and execute pod install

One last thing is to adjust settings in your project (you will run into issues if you don't.
Check this post for details: #790

In Xcode, in your app target build phases, you should have something called "Embed App Extensions" or "Embed Foundation Extensions" at the end of the build phases. If you drag it BEFORE "Run Script", it should prevent this build error to happen.

It will probably be somewhere at the bottom, so drag and drop it above. Now your can built your app ;)

image

@jaca420
Copy link

jaca420 commented Sep 1, 2024

Getting the same error when building. I followed the instructions from here:

https://documentation.onesignal.com/docs/flutter-sdk-setup

But still getting the No Module Found "OneSignalExtension"

Not sure how to fix this.

@affan3699
Copy link

same here

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

5 participants