Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase doesn't build on M1 simulator (Cannot find 'Analytics' in scope)

Since I have switched to M1, it has proven impossible running the app on the simulator. On the device itself it works fine.

I get the build error: Cannot find 'Analytics' in scope

import Firebase

class AlertService: AlertServiceBase, AlertServiceProtocol {

  func showWarningAlert(dict: NSDictionary) {
     ...
     Analytics.logEvent("blocked_no_more_warning", parameters: nil)
  }
}

I spoke to an Apple engineer and he said to change all Pods architecture to Standard Architectures (arm64, armv7) - $(ARCHS_STANDARD).

It helped a bit to progress further, but then it failed on the firebase analytics issue. He suggested to post the issue here on SO. Hopefully someone had this before. Thanks

like image 717
Houman Avatar asked Dec 30 '22 14:12

Houman


1 Answers

I had this issue only when debugging on a physical device, simulator worked fine.

Additional to the import Firebase, I had to import FirebaseAnalytics

like image 73
Sizzle Avatar answered Jan 05 '23 18:01

Sizzle