Angular 我的个人资料图片只有在我在应用程序加载时触摸它后才会出现

Angular 我的个人资料图片只有在我在应用程序加载时触摸它后才会出现,angular,typescript,firebase,ionic4,Angular,Typescript,Firebase,Ionic4,我用Ionic 4、Firebase和Angular创建了一个社交媒体应用程序,它在Android上运行良好。但在iOS上,当我加载应用程序时,除非我真的触摸它,否则我的个人资料图片不会出现 这是密码 async ngOnInit(){ firebase.auth().onAuthStateChanged(用户=>{ log('onAuthStateChanged',user.uid); this.currentUser=用户; this.imageService.getImageDownlo

我用Ionic 4、Firebase和Angular创建了一个社交媒体应用程序,它在Android上运行良好。但在iOS上,当我加载应用程序时,除非我真的触摸它,否则我的个人资料图片不会出现

这是密码

async ngOnInit(){
firebase.auth().onAuthStateChanged(用户=>{
log('onAuthStateChanged',user.uid);
this.currentUser=用户;
this.imageService.getImageDownloadUrl('profilePicture',user.uid)
。然后((照片)=>{
log('getImageDownloadUrl',照片);
this.profilePicture=(photo=='undefined')?'false':photo;
console.log('profilePicture',this.profilePicture);
});
});
}

试试我在下面使用的NgZone代码,你可以得到你想要的吗

 constructor(ngZone: NgZone){ }

async ngOnInit() {
  firebase.auth().onAuthStateChanged(user => {
    this.currentUser = user;
    this.imageService.getImageDownloadUrl('profilePicture', user.uid)
      .then((photo) => {
        console.log('getImageDownloadUrl', photo);

        this.ngZone.run(() => {
          this.profilePicture = (photo === 'undefined') ? 'false' : photo;
          console.log('profilePicture', this.profilePicture);
        }
          });
  });
}

在你在iOS上点击应用程序之前,它会显示你的默认图片还是两张图片都不显示?如何测试这些平台-emulator,通过xcode构建…?当我上传个人资料图片时,它会正确加载到应用程序和Firebase中。一旦我关闭应用程序并重新打开,它就会恢复到我的默认图片。这只发生在IOS中。Android加载了储存在Firebase中的个人资料图片。所以你将图片保存在Firebase存储中,不是吗?您是否为iOS设置了Firebase存储?也许能帮你是的,我帮过你。Android的一切都正常运行。我真的不知道如何解决这个问题。通常会出现这些iOS问题,因为遵循某些标准的环境更为严格(例如,angular date pipe并不像firefox那样适用于所有日期格式),但在您的示例中很难说明这一点。如果我有别的想法,我会再评论,否则祝你好运。