So, I've requested my app to be published to the App store. I am new to apple development, so I don't know what the crash log really says nor how it would apply to my code. The app works on my Xcode simulators and my own device, but according to apple it fails on startup?
Apparently, crash report is too big to post, so here is my App Delegate:
//
// AppDelegate.swift
// YorkCougars
//
// Created by ADMIN on 8/13/24.
//
import Foundation
import SwiftUI
import WebKit
import FirebaseCore
import FirebaseAuth
import FirebaseMessaging
class AppDelegate:NSObject,UIApplicationDelegate,UNUserNotificationCenterDelegate, MessagingDelegate{
func registerForNoti(application:UIApplication){
UNUserNotificationCenter.current().delegate = self
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions,
completionHandler: { _, _ in }
)
application.registerForRemoteNotifications()
}
func application(_ application:UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil)-> Bool{
FirebaseApp.configure()
DatabaseHandler.onStart()
DatabaseHandler.startObservingAll()
registerForNoti(application: application)
Messaging.messaging().delegate = self
Messaging.messaging().subscribe(toTopic: "QUARTER")
Messaging.messaging().subscribe(toTopic: "ALL")
//Messaging.messaging().subscribe(toTopic: "DEV")
DatabaseHandler.observe(fromRootLocation: "refreshrate"){snapshot in
gl.shared.reload = true
gl.shared.sbURL = "?r=\(snapshot.value as? Int ?? 0)"
print("lol")
}
return true;
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)
{
Messaging.messaging().setAPNSToken(deviceToken, type: .unknown)
}
}
extension AppDelegate {
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
let userInfo = notification.request.content.userInfo
Messaging.messaging().appDidReceiveMessage(userInfo)
// Change this to your preferred presentation option
completionHandler([[.banner, .list, .sound]])
}
func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void) {
let userInfo = response.notification.request.content.userInfo
Messaging.messaging().appDidReceiveMessage(userInfo)
completionHandler()
}
func application(_ application: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable : Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
Messaging.messaging().appDidReceiveMessage(userInfo)
completionHandler(.noData)
}
}