Notes
- Recently updated to Xcode Version 14.2 (14C18)
- Flutter 3.7.0 • channel stable
Problem
When running my flutter app for ios, I get this error:
Xcode build done. 86.8s
Failed to build iOS app
Could not build the precompiled application for the device.
Swift Compiler Error (Xcode): No such module 'shared_preferences_ios'
/Users/tomasward/Desktop/fredi_new/ios/Runner/AppDelegate.swift:3:7
Which is derived from this piece of code in AppDelegate.swift
:
import UIKit
import Flutter
import awesome_notifications
import shared_preferences_ios //error here
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
application.registerForRemoteNotifications()
SwiftAwesomeNotificationsPlugin.setPluginRegistrantCallback { registry in
SwiftAwesomeNotificationsPlugin.register(
with: registry.registrar(forPlugin: "io.flutter.plugins.awesomenotifications.AwesomeNotificationsPlugin")!)
FLTSharedPreferencesPlugin.register(
with: registry.registrar(forPlugin: "io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin")!)
}
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
This code is boilerplate for the awesome_notifications
plugin setup for ios. See here
I Have tried a million solutions
- Deleting ios build and running
flutter create .
- Running
pod install
a million times, deleting podfile, etc.
No solution seems to be consistent. I am looking for a general solution from people working on Flutter
projects, not native ios projects.
Also it would be great if someone who worked with awesome_notifications
could give me some insight