microsoft / react-native-code-push

React Native module for CodePush
http://appcenter.ms
Other
8.98k stars 1.47k forks source link

ios codepush error CodePushDownloadProgress #516

Closed xlj44400 closed 7 years ago

xlj44400 commented 8 years ago

2016-09-16 12:43:04.486 [warn][tid:com.facebook.react.CodePushQueue][RCTEventEmitter.m:54] Sending CodePushDownloadProgress with no listeners registered. 2016-09-16 12:43:04.621 [error][tid:com.facebook.react.CodePushQueue][RCTEventEmitter.m:46] CodePushDownloadProgress is not a supported event type for CodePush. Supported events are: (null)

richardhuaaa commented 8 years ago

Which version of RN/CodePush/iOS are you running? We will try to look at this within the next two days.

iZaL commented 8 years ago

+1

richardhuaaa commented 8 years ago

@xlj44400, @iZaL - which versions of RN, CodePush, and iOS are you seeing this on?

richardhuaaa commented 8 years ago

@xlj44400, @iZal - I think I've found the code causing the problem and fixed it in #526.

The bug was merged into master but not yet released to npm. Can you confirm that you found this issue while running the CodePush version on our master branch, possibly with the example app? We've traditionally done most of our testing before npm releases, but in future we will aim to do more up-front so that our master branch is stable.

richardhuaaa commented 8 years ago

Also, note that once you've synced to the latest commit, you'll need to delete the react-native-code-push folder in your app's node_modules (rm -r <AppName>/node_modules/react-native-code-push), and then run npm install again, because npm doesn't automatically detect changes in local file dependencies.

hojberg commented 7 years ago

Is this supposed to be fixed in 1.16.1-beta ?

sergey-akhalkov commented 7 years ago

@hojberg - hi! Changes probably fixing the issue are already in CodePush.m and package-mixins.js files belong to react-native-code-push having version 1.16.1-beta.

jaggerwang commented 7 years ago

Still there!

image

codePush.sync({deploymentKey});

I'm using pull #670 , because my RN version is 0.40.0.

sergey-akhalkov commented 7 years ago

@jaggerwang - hi! I've got the same warning while using react-native@0.40.0 and react-native-code-push@1.17.0-beta, so I've started investigation.

jonrh commented 7 years ago

@sergey-akhalkov Just to confirm or chime in. I'm new to CodePush but I have the same error running react-native@0.40.0 and react-native-code-push@1.17.0-beta.

I was following the Plugin Usage guide (awesome docs btw, good job!). Fetching a new bundle works on app restart but it doesn't work on app resume.

// Works correctly after app restarts
MyApp = codePush(MyApp);
// Doesn't work on app resume, but I may be missing or doing something wrong
let codePushOptions = { checkFrequency: codePush.CheckFrequency.ON_APP_RESUME };
MyApp = codePush(codePushOptions)(MyApp);

Update 2017-02-09: Updating works correctly on app resume, second code snippet was me simply misunderstanding the updating mechanism. Implementing the codePushDownloadDidProgress() method silenced the errors. Thanks @sergey-akhalkov!

sergey-akhalkov commented 7 years ago

@jaggerwang, I've found the place where the warning occurs: https://github.com/facebook/react-native/blob/master/React/Modules/RCTEventEmitter.m#L54 It happens when there are no event listeners registered for CodePushDownloadProgress event. So to go it away you could just implement realization of codePushDownloadDidProgress method:

export default class myapp extends Component {
  codePushDownloadDidProgress(progress) {
        console.log(progress.receivedBytes + " of " + progress.totalBytes + " received.");
  }
  ...
  }
}

Please let me know if there are any issues like this one

2016-09-16 12:43:04.621 [error][tid:com.facebook.react.CodePushQueue][RCTEventEmitter.m:46] CodePushDownloadProgress is not a supported event type for CodePush. Supported events are: (null)

or if I could help you.

sergey-akhalkov commented 7 years ago

@jonrh,

// Doesn't work on app resume, but I may be missing or doing something wrong let codePushOptions = { checkFrequency: codePush.CheckFrequency.ON_APP_RESUME }; MyApp = codePush(codePushOptions)(MyApp);

Hmm, I've tried this option and it works well for me. Could you please try our demo app? It prints CodePush statuses on the screen, so you could see if the option works. Let me know if you have any questions or see any issue.

LiuC520 commented 7 years ago

Me too,

[CodePush] Disallowing restarts [CodePush] Re-allowing restarts [CodePush] Checking for update. [CodePush] Downloading package. Sending CodePushDownloadProgress with no listeners registered. [CodePush] An unknown error occurred. [CodePush] The folder “unzipped” doesn’t exist.

xcode logger: [CodePush] Error deleting downloaded file: Error Domain=NSCocoaErrorDomain Code=4 "“download.zip” couldn’t be removed." UserInfo={NSFilePath=/Users/vittorio/Library/Developer/CoreSimulator/Devices/88E4ABE2-F4DC-4836-974C-0CFEC3A273F2/data/Containers/Data/Application/DE678A99-45DB-423D-A972-7F836A556410/Library/Application Support/CodePush/download.zip, NSUserStringVariant=( Remove ), NSUnderlyingError=0x600000447890 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

let codePushOptions = { checkFrequency: CodePush.CheckFrequency.ON_APP_RESUME };
componentWillMount() {
        CodePush.disallowRestart();//页面加载的禁止重启,在加载完了可以允许重启
    }

    componentDidMount(){
        CodePush.allowRestart();//允许重启,否则热更新不会生效
        CodePush.sync({ 
            installMode: CodePush.InstallMode.IMMEDIATE,
            updateDialog: false,
        })
    }
...
Main = CodePush(codePushOptions)(Main);
sergey-akhalkov commented 7 years ago

@LiuC520, seems like it's the issue of another kind. I believe that the root of the problem is not in Sending CodePushDownloadProgress with no listeners registered. warning, but you could try to add codePushDownloadDidProgress event listener as I've described above and verify if it works. In case the error still reproduces, could you please create separate issue and provide us additional info?

LiuC520 commented 7 years ago

Thank you for your suggestion. I've add codePushDownloadDidProgress event listener,but there is a new problem: https://github.com/Microsoft/react-native-code-push/issues/695

sergey-akhalkov commented 7 years ago

Closing this for now, please feel free to reopen.

sospedra commented 6 years ago

I've the same problem with 5.2.0-beta and the workaround didn't seems to work. Tho, honestly I'm not sure were to place it?

ruslan-bikkinin commented 6 years ago

Hi @sospedra. Please fill new issue as we could discuss your particular case and help you.

SudoPlz commented 6 years ago

If you're using CodePush.sync then the third parameter is what causes that issue (particularly leaving the 3rd param empty)

CodePush.sync(
      {}, // codepush options
      (syncStatus) => { // status callback
            // do smthing with the sync status
      },
      (progress) => { // progress callback (Specify a function here otherwise you'll get a warning)
            // do smthing with the progress value
      }
);
igorferst commented 6 years ago

I see the warning in question (Sending CodePushDownloadProgress with no listeners registered) with react-native@0.55.4 and react-native-code-push@5.4.0. The suggestion to implement codePushDownloadDidProgress indeed removed the warning. Please consider adding a note about this to the setup or troubleshooting instructions.

chenlongwill commented 5 years ago

[CodePush] Downloading package. YellowBox.js:67 Sending CodePushDownloadProgress with no listeners registered. console.warn @ YellowBox.js:67 logToConsole @ RCTLog.js:47 logIfNoNativeHook @ RCTLog.js:30 callFunction @ MessageQueue.js:349 (anonymous) @ MessageQueue.js:106 guard @ MessageQueue.js:297 callFunctionReturnFlushedQueue @ MessageQueue.js:105 (anonymous) @ debuggerWorker.js:72 logging.js:3 [CodePush] An unknown error occurred. logging.js:3 [CodePush] The update contents failed the data integrity check.

The update contents failed the data integrity check.

faisal-aym commented 5 years ago

Hi,

react-native-code-push: ^5.4.2 react-native: 0.55.4

I am getting this error on app install when checking for update. Its coming randomly not on each and every install. I have implemented codePushDownloadDidProgress

What could cause this error?

codepush error
yasircodingcrafts commented 3 years ago

How can I remove this warning if my main app is a functional component? PS: I can't convert it to class component. Thanks

kirgy commented 2 years ago

Also facing this issue with a functional component.

Sending `CodePushDownloadProgress` with no listeners registered.
const useCodePushSync = (dispatch: ReturnType<typeof useAppDispatch>) => {
  codePush.sync(
    { installMode: codePush.InstallMode.ON_NEXT_RESTART },
    status => {
      let isPending = false;
      if (status === codePush.SyncStatus.UPDATE_INSTALLED) {
        dispatch(setMetaIsPendingRestart(true));
        isPending = true;
      }
      codePush.getUpdateMetadata().then(metadata => {
        dispatch(
          setMeta(
            !metadata
              ? null
              : {
                  label: metadata.label,
                  version: metadata.appVersion,
                  description: metadata.description,
                  isPending: isPending,
                },
          ),
        );
      }),
        (progress: DownloadProgress) => {
          console.log({ progress }); // adding this 3rd param does not resolve the warning
        };
    },
  );
};
bonnmh commented 2 years ago
image

the same problem :(

bonnmh commented 2 years ago

react-native: 0.64.2 react-native-code-push: 7.0.5

   codePush.sync(
            {deploymentKey: CODE_PUSH_DEV_KEY_FINAL},
            (status) => codePushStatusDidChange(status, timeoutSync),
            codePushDownloadDidProgress,
        );
bonnmh commented 2 years ago
image

App has been updated, but status and progress is not working

parthindia47 commented 1 year ago

Is there any update on this ?

parthindia47 commented 1 year ago
image

App has been updated, but status and progress is not working

I am having same issue