He terminado de desarrollar una nueva versión de mi aplicación, la cual incluye notificaciones a través de FireBase Cloud Messaging. A la hora de compilar la aplicación para probar las funcionalidades. Me sale el siguiente error:
El ContentView de mi aplicación es el siguiente.
import SwiftUI import WebKit import Firebase import FirebaseMessaging
class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDelegate { func application (_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { FirebaseApp.configure () requestAuthorizationForPushNotification(application: application) return true }
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, witchCompletionHandler
completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler([.banner, .sound])
}
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler
completionHandler: @escaping () -> Void) {
completionHandler()
}
private func requestAuthorizationForPushNotification(application: UIApplication) {
UNUserNotificationCenter.current().delegate = self
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { _, _ in }
application.registerForRemoteNotifications()
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Messaging.messaging().apnsToken = deviceToken
}
struct ContentView: View {
@State private var showWebView = false
private let urlString: String = "https://b-p-s-o-badajoz-beta.flutterflow.app/"
var body: some View {
VStack(spacing: 40) {
WebView(url: URL(string: urlString)!).frame(height: 890.0) .cornerRadius(10)
.shadow(color: .black.opacity(0.3), radius: 20.0, x: 5, y: 5)
}
}
struct WebView: UIViewRepresentable {
var url: URL
func makeUIView(context: Context) -> WKWebView {
return WKWebView()
}
func updateUIView(_ uiView: WKWebView, context: Context) {
let request = URLRequest(url: url)
uiView.load(request)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
}
}