electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.48k stars 514 forks source link

Deprecated API Usage when submitting to MAS - QuickTime/QTKit APIs #464

Closed mattxwang closed 6 years ago

mattxwang commented 6 years ago

Please describe your issue:

After compiling my app using electron-forge package --platform=mas, and submitting my app to the Mac App Store (with intermediary steps), I get the error: "Deprecated API Usage - Apple no longer accepts submissions of apps that use QuickTime or QTKit APIs.

Error Screenshot

I've done some snooping around, and some of the only other issues that replicate this are with very old versions of Electron and electron-packager, or with people not using the --platform=mas command properly. However, my version of electron-forge and the created app both use relatively updated versions of each dependency, and I'm using the --platform=mas option.

Has anybody else encountered a problem publishing an Electron-Forge app to the Mac App Store? I'm currently using the Angular 5 boilerplate - my code is available here.

What command line arguments are you passing?

electron-forge package --platform=mas
electron-osx-sign ...
electron-osx-flat

I upload the file outputted by electron-osx-flat, but I've identified that the problem is with electron-forge package --platform=mas - the other two commands work on a non-Electron Forge project.

What does your config.forge data in package.json look like?

"config": {
    "forge": {
      "make_targets": {
        "win32": [
          "squirrel"
        ],
        "darwin": [
          "zip"
        ],
        "linux": [
          "deb"
        ]
      },
      "electronPackagerConfig": {
        "packageManager": "npm",
        "icon": "src/assets/img/fair-chair.icns",
        "ignore": ".+.o$",
        "appBundleId": "me.matthewwang.fair-chair",
        "helperBundleId": "me.matthewwang.fair-chair.helper",
        "buildVersion": "1.0.2"
      },
      "electronWinstallerConfig": {
        "name": "fair_chair"
      },
      "electronInstallerDebian": {},
      "github_repository": {
        "owner": "malsf21",
        "name": "fair-chair"
      },
      "windowsStoreConfig": {
        "packageName": "",
        "name": "fairchair"
      }
    }
  }
malept commented 6 years ago

Off-topic, is there a reason why you use electron-osx-sign outside of Forge? I'd like to know what sort of functionality using it via electronPackagerConfig is missing.

Also, you shouldn't have both electron in your dependencies and electron-prebuilt-compile in your devDependencies. Just have the latter.

With regards to your issue about deprecated APIs: This is not something that is an issue with Electron Forge, but rather with Electron itself. Although, I'm not sure whether to point you toward the community sites or the Electron issue tracker, I'd have to defer to @MarshallOfSound on that.

MarshallOfSound commented 6 years ago

Which electron version is this? And can you verify in your packaged app that process.mas is true

malept commented 6 years ago

It's 1.8.4 according to the linked repo.

mattxwang commented 6 years ago

@malept thank you for the feedback, I've adjusted my package.json. The reason that I use electron-osx-sign instead of electronPackagerConfig is partially because I'm not comfortable with putting my identity in the package.json, and partially because it works well into using electron-osx-flat. However, I can try using electronPackagerConfig instead!

I'm not entirely sure if this is just an electron issue, because i've uploaded a non-electron forge app to the MAS and it's worked properly (i.e. creating a vanilla app, using electron-osx-sign and electron-osx-flat, and then using Application Loader to load the app into the MAS). I think this might have to do with how --platform=mas is interpreted by Electron Forge, but I'm not entirely sure.

@MarshallOfSound , I'm using electron version 1.8.4. Where would I check to find process.mas ?

malept commented 6 years ago

I'm not comfortable with putting my identity in the package.json

That's fair. I believe electron-osx-sign uses the default identity on a machine if you don't specify one. If you'd rather use an environment variable, you could use the forge.config.js method and read the environment variable via JS.

it works well into using electron-osx-flat.

I'm interested in learning more about that.

Where would I check to find process.mas ?

You'd put it in your app (temporarily) in src/index.ts, e.g.:

console.log(process.mas);
mattxwang commented 6 years ago

Thanks for the suggestion @malept , I ran console.log(process.mas) and got true when injecting it into src/index.ts and when running it from DevTools. I guess that means that electron-forge is properly using the mas version of electron? Yet, I'm still confused as to what is using the QuickTime/QTKit APIs, since the latest electron build doesn't use it.

mattxwang commented 6 years ago

@MarshallOfSound , any thoughts? Is there somewhere else that I should look for, or another project I should consult?

mattxwang commented 6 years ago

@MarshallOfSound @malept I think I figured out the problem, which is quite odd. I did a full reset of my node configuration (so deleting node_modules, reinstalling node and my global packages), and I still encountered the problem - however, I noticed that the electron package was still in my MAS-packaged app's contents even after removing it with the suggestion from @malept . This should be unexpected behaviour, as I was not installing electron into the app (but it was required by electron/types.

This is problematic because the electron package contains Electron.app, the distributable .app, which is not MAS compliant. Therefore, this is what was triggering the QtKit alert (at least to my knowledge).

So, before signing the app (but after packaging it with electron-forge package --platform=mas), I went into the .app's package contents, deleted Resources/app/node_modules/electron/dist (which contains the Electron.app), and then proceeded normally. My app was successfully submitted to the MAS.

I'm not entirely sure what's causing this to happen - I think it's the requirement of electron from electron/types, which is a non-mas compliant distributable. What do you think?