firebase-analytics icon indicating copy to clipboard operation
firebase-analytics copied to clipboard

setScreenName:screenClass: must be called from the main thread to ensure that events are associated with the intended screen.

Open ujeon opened this issue 4 years ago • 4 comments

Describe the bug I have tried to set screen name using setScreenName in Angular 8, but it returns "setScreenName:screenClass: must be called from the main thread to ensure that events are associated with the intended screen."

Expected behavior I expected setScreenName method change screen name, so Firebase Analytics tracks the name I set.

Screenshots Xcode console 스크린샷 2020-07-02 20 42 00

Angular 8 source code 스크린샷 2020-07-02 20 42 58 스크린샷 2020-07-02 20 43 42

and package.json

{
  "name": "shaashop-1.1-ionic",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~8.1.2",
    "@angular/common": "~8.1.2",
    "@angular/core": "~8.1.2",
    "@angular/forms": "~8.1.2",
    "@angular/platform-browser": "~8.1.2",
    "@angular/platform-browser-dynamic": "~8.1.2",
    "@angular/router": "~8.1.2",
    "@capacitor-community/firebase-analytics": "^0.1.3",
    "@capacitor/android": "^2.1.0",
    "@capacitor/core": "^2.1.0",
    "@capacitor/ios": "^2.1.0",
    "@ionic-native/core": "^5.0.0",
    "@ionic-native/splash-screen": "^5.0.0",
    "@ionic-native/status-bar": "^5.0.0",
    "@ionic/angular": "^4.7.1",
    "@ngx-translate/core": "^12.1.2",
    "@ngx-translate/http-loader": "^5.0.0",
    "cordova-support-android-plugin": "^1.0.2",
    "cordova-support-google-services": "^1.4.1",
    "core-js": "^2.5.4",
    "google-libphonenumber": "^3.2.10",
    "i18n-iso-countries": "^6.0.0",
    "rxjs": "~6.5.1",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/architect": "~0.801.2",
    "@angular-devkit/build-angular": "~0.801.2",
    "@angular-devkit/core": "~8.1.2",
    "@angular-devkit/schematics": "~8.1.2",
    "@angular/cli": "~8.1.2",
    "@angular/compiler": "~8.1.2",
    "@angular/compiler-cli": "~8.1.2",
    "@angular/language-service": "~8.1.2",
    "@capacitor/cli": "2.1.0",
    "@ionic/angular-toolkit": "^2.1.1",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^8.9.5",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.4.3"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {}
  }
}

Additional context I found "setScreenName:screenClass: must be called after [super viewDidAppear:]." in FIRAnalytics documents

and also found this issue in cordova-firebase-plugin

Thank you!

ujeon avatar Jul 02 '20 11:07 ujeon

v.0.2.0 is now published. Please give it a try and let me know of the end result.

priyankpat avatar Jul 12 '20 14:07 priyankpat

I have the same problem within a Vue with capacitor project. Upgrading to 0.2.0 (and fixing the "get remoteConfig()" syntax problem manually https://github.com/capacitor-community/firebase-analytics/pull/26) didn't fix the problem. setScreenName still doesn't work properly.

If there's anything you would suggest testing or tweaking, please inform, I will gladly help with the issue.

gkrajuska avatar Jul 28 '20 18:07 gkrajuska

I have the same problem within a Vue with capacitor project. Upgrading to 0.2.0 (and fixing the "get remoteConfig()" syntax problem manually #26) didn't fix the problem. setScreenName still doesn't work properly.

If there's anything you would suggest testing or tweaking, please inform, I will gladly help with the issue.

Well, v0.2.0 resolved my issue (setScreenName:screenClass: must be called from the main thread to ensure that events are associated with the intended screen) and my project is Angular with capacitor.

I think "get remoteConfig()" syntax error is different issue. Because that issue is related with TypeScript. Incidentally, I remove "get" in "get remoteConfig()" and It worked.

I hope that you has resolved that issue.😀

ujeon avatar Aug 04 '20 11:08 ujeon

@gkrajuska it sounds like this was resolved for Angular projects with v0.2.0, are you still seeing this with Vue?

brownoxford avatar Apr 06 '21 20:04 brownoxford

closing since there was no response if somebody still faces this issue, please, create a new issue and provide a sample app where the issue can be reproduced

jcesarmobile avatar Nov 11 '22 22:11 jcesarmobile