如何发布一个用 flutter 编写的 macos 应用程序
How to release a macos app written with flutter
我有一个 flutter 应用程序,它是我在 macOS 的 Flutter 中构建的。但是我想不出一种方法来共同设计 Application.app 包。我已经在互联网上搜索过,但找不到正确的方法。
The procedure is very simple. But it's not properly documented anywhere.
- Get a certificate from Xcode. The simplest step is to use Xcode, add a new certificate. Read more about it here https://help.apple.com/xcode/mac/current/#/dev154b28f09
- Once you have the certificate you need to find the identity for it to sign your app .
security find-identity -p codesigning
运行 this in terminal and copy hash it gives you against the certificate name you just created.
- build the release version of your flutter app by 运行ning
flutter build macOS
in your project folder
UPDATE flutter build macOS doesn't work any more. Try flutter build macos
instead. Refer。 Thank you @Bartosz for pointing it out in comments.
cd
into the folder where your app is created. now 运行 codesign --deep --force --verbose --sign "<identity>" Application.app
Supply the hash we coped in step 2 in place of (Keep the quotes).
You should see something like this Application.app: signed bundle with Mach-O thin (x86_64) [com.application]
- Verify the signature
codesign --verify -vvvv Application.app
and spctl -a -vvvv Application.app
First one will give you something like
Application.app: valid on disk
Application.app: satisfies its Designated Requirement
Second one will give you something like
Application.app: accepted
source=Developer ID
origin=Developer ID Application: Spreaker Inc (xxx)
Read more about it https://pracucci.com/atom-electron-signing-mac-app.html
Flutter Desktop is wonderful. But coming from an Android Dev background, I had no idea how to sign in mac. Hope it helps someone.
您可以简单地在 Xcode 项目中设置您的签名身份,使用 UI 或 xcconfig,就像任何标准的 macOS 应用程序一样。签名过程与 Flutter 无关。
我有一个 flutter 应用程序,它是我在 macOS 的 Flutter 中构建的。但是我想不出一种方法来共同设计 Application.app 包。我已经在互联网上搜索过,但找不到正确的方法。
The procedure is very simple. But it's not properly documented anywhere.
- Get a certificate from Xcode. The simplest step is to use Xcode, add a new certificate. Read more about it here https://help.apple.com/xcode/mac/current/#/dev154b28f09
- Once you have the certificate you need to find the identity for it to sign your app .
security find-identity -p codesigning
运行 this in terminal and copy hash it gives you against the certificate name you just created. - build the release version of your flutter app by 运行ning
flutter build macOS
in your project folder UPDATE flutter build macOS doesn't work any more. Tryflutter build macos
instead. Refer。 Thank you @Bartosz for pointing it out in comments. cd
into the folder where your app is created. now 运行codesign --deep --force --verbose --sign "<identity>" Application.app
Supply the hash we coped in step 2 in place of (Keep the quotes).
You should see something like this Application.app: signed bundle with Mach-O thin (x86_64) [com.application]
- Verify the signature
codesign --verify -vvvv Application.app
andspctl -a -vvvv Application.app
First one will give you something like
Application.app: valid on disk
Application.app: satisfies its Designated Requirement
Second one will give you something like
Application.app: accepted
source=Developer ID
origin=Developer ID Application: Spreaker Inc (xxx)
Read more about it https://pracucci.com/atom-electron-signing-mac-app.html
Flutter Desktop is wonderful. But coming from an Android Dev background, I had no idea how to sign in mac. Hope it helps someone.
您可以简单地在 Xcode 项目中设置您的签名身份,使用 UI 或 xcconfig,就像任何标准的 macOS 应用程序一样。签名过程与 Flutter 无关。