I am getting the following error when trying to archive my build on XCode:
/Users/AppDelegate.swift:18:9: 'guard' body may not fall through, consider using 'return' or 'break' to exit the scope
It is a little frustrating, because it is the exact code that Google Analytics (I just copied/pasted) suggests you to put in appdelegate to set-up their analytics. Also, it only occurs when archiving my build. It does not occur when just running my code in the simulator.
Would appreciate if anyone had some ideas.
EDIT: I also tried placing a break or continue after the assert, but I got an error...Something about it not being a loop.
import UIKit
import Firebase
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FIRApp.configure()
//Google Analytics
guard let gai = GAI.sharedInstance() else {
assert(false, "Google Analytics not configured correctly")
}
gai.tracker(withTrackingId: "xxxxxxxxxxx")
// Optional: automatically report uncaught exceptions.
gai.trackUncaughtExceptions = true
// Optional: set Logger to VERBOSE for debug information.
// Remove before app release.
gai.logger.logLevel = .verbose;
return true
}