0

我的代码推送正在模拟器上工作,但是当我在设备上运行相同的应用程序时,它显示我更新对话框,但是当我按下安装时什么也没有发生。代码推送不更新iOS设备上的应用程序

class MyApp extends React.Component { 
    constructor() { 
     super(); 
     this.state = { 
      logs: [] 
     } 
    } 
    codePushStatusDidChange(status) { 
     let msg = ''; 
     switch(status) { 
      case codePushComponent.SyncStatus.CHECKING_FOR_UPDATE: 
       msg = ("Checking for updates."); 
       break; 
      case codePushComponent.SyncStatus.DOWNLOADING_PACKAGE: 
       msg = ("Downloading package."); 
       break; 
      case codePushComponent.SyncStatus.INSTALLING_UPDATE: 
       msg = ("Installing update."); 
       break; 
      case codePushComponent.SyncStatus.UP_TO_DATE: 
       msg = ("Up-to-date."); 
       break; 
      case codePushComponent.SyncStatus.UPDATE_INSTALLED: 
       msg = ("Update installed."); 
       break; 
     } 
    } 
    codePushDownloadDidProgress(progress) { 
     console.log(progress.receivedBytes + " of " + progress.totalBytes + " received."); 
    } 
    update() { 
     codePushComponent.sync({ 
      updateDialog: true, 
      installMode: codePushComponent.InstallMode.IMMEDIATE 
     },() => this.codePushStatusDidChange,() => this.codePushDownloadDidProgress); 
    } 

    render(){ 
     return (
      <View style={styles.container}> 
       <Text style={styles.welcome}> 
        Welcome 
       </Text> 
       <Text style={styles.instructions}> 
        Update version 1.0 
       </Text> 
       <Button title="Update" onPress={() => this.update()} /> 
      </View> 
     ) 
    } 
} 
export default (MyApp) 

附加资料

  • 反应本机代码的推版本: 4.1.0-β
  • 反应本地版本: 16.0.0-alpha.12
  • iOS /安卓/ Windows版本: IOS 10.3
  • 这是否在调试版本或发行版本上重现? Release
  • Release这是在模拟器上还是在物理设备上重现? 物理设备仅

回答

相关问题