DavidStrausz/cordova-plugin-today-widget

PbxProject is not changed

Closed this issue · 4 comments

Firstly, thank you for writing this amazing plugin, our company was in very much need of it, but none of us had the knowledge to do so yet.

I have been working on changing it to also work with other widget names and locations (due to our existing widget) but before that even, using the steps as you described, no changes are shown in the project when opening xcode.

I've started debugging and everything seems fine, up until the moment it writes the file. No actual change in the file is observed and I cannot understand why.

The lines of relevant code are:

      // Write the modified project back to disc
      log('Writing the modified project back to disk ...', 'info');
      fs.writeFileSync(projectPath, pbxProject.writeSync());
      log(
        'Added app extension to ' + projectName + ' xcode project',
        'success'
      );
      console.log('\x1b[0m'); // reset

      deferral.resolve();

I'm hoping you can help me and our company (in that case we're wondering if you have a donate button somewhere ;) ) And then I can help to generalize your plugin.

Hi @RomanovX
Thanks for the kind words, I'm glad the plugin is of use for your company!

First things that come to my mind on how to debug this:

  • Add some additional console.logs printing paths, project-name, etc. and check if reading/writing happens for the same file
  • Put the fs.writeFileSync(...) part in a try/catch block and check if an error is thrown
  • If the project can be read from the directory but not written this sounds like something could be wrong with permissions or maybe the pbx project is locked by some other process

Hi @DavidStrausz , thanks for your quick reply.

I did all of those things, but won't get any errors, it just doesn't write... Anyhow, for now I've been looking at just the project file if I write it to another file (since that does work) and checking what still needs fixes...

Anyhow, for me debugging this is probably much more timeconsuming than for you so would you possibly be up for something like a skype session? Obviously I will ask my boss for a financial compensation for you.

Let me know!

That sounds really strange. "Just doesn't write" seems very odd. How do you check if the file was modified or not?

Actually not a fan of Skype sessions but DM me on the cordova slack channel (david257) and we can try to figure this out!

#2 Should fix all of this