分类
科技文章

mac终端访问iCloud Drive

iCloud Drive 目录位于 Mobile Documents。可以在终端里这样访问 iCloud Drive,从用户的 home 目录进入:

cd ~/Library/Mobile\ Documents/com~apple~CloudDocs
分类
科技文章

electron 12版本preload.js问题

最新的electron 12.x版本中,在preload.js中直接给render进程的window挂载api已经无效了,electron提供了新的注入jsbridge的机制,对原有代码稍加改动即可:

例如在render进程的window上挂载$electron

contextBridge.exposeInMainWorld('$electron', electron);
分类
科技文章

apache切换php版本

在ubuntu18.04上可以安装7.4版本,参考这里。安装好了之后,在终端里php -v会显示7.4版本,但是apache2使用的php模块并不会直接更换版本。可以使用如下方法切换。

sudo a2dismod php7.2
sudo a2enmod php7.4
sudo service apache2 restart
分类
科技文章

SharedArrayBuffer更新

[Deprecation] SharedArrayBuffer will require cross-origin isolation as of M91, around May 2021. See https://developer.chrome.com/blog/enabling-shared-array-buffer/ for more details.

如果页面上的脚本用到了SharedArrayBuffer,需要配置跨域相关策略,根据官方指导,再引用脚本的入口文件配置如下即可

Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin

如果用的Apache2,可以在.htaccess中只为特定的目录开启。

<IfModule mod_headers.c>
  Header set Cross-Origin-Embedder-Policy require-corp
  Header set Cross-Origin-Opener-Policy same-origin
</IfModule>
分类
科技文章

mac上批量转换HEIC到JPG

iPhone拍摄照片默认是HEIC格式

macOS内置了一个终端工具,sips,用这个就可以转换格式

批量转换:

find . -name "*.HEIC" -exec bash -c 'sips -s format jpeg -s formatOptions default $1 --out ${1%.*}.jpg' bash {} \;
分类
科技文章

libmp3lame库编译的错误

在macOS上编译libmp3lame报错,3.100版本

Undefined symbols for architecture x86_64:
  "_lame_init_old", referenced from:
     -exported_symbol[s_list] command line option
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [libmp3lame.la] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

解决办法

删除 include/libmp3lame.sym 中的lame_init_old

分类
支持

隐私政策(Privacy Policy)

A. 介绍

  1. 我们非常重视并承诺保护网站访客的隐私。本政策详细阐述了我们对个人信息的处理方式。
  2. 当您首次访问我们的网站时,如果您同意我们遵循本政策的条款使用cookie,则意味着此后您每次访问我们的网站时,都允许我们使用cookie。

B. 版权说明
本文档基于SEQ Legal(seqlegal.com)的模板创建。

C. 收集个人信息

以下类型的个人信息可能被收集、保存和使用:

  1. 有关您的计算机的信息,包括您的IP地址、地理位置、浏览器类型和版本以及操作系统;
  2. 有关您访问和使用本网站的信息,包括流量来源、访问时间、页面浏览量和网站导航路径;
  3. 在我们的网站上注册时填写的信息,例如您的电子邮箱地址;
  4. 您在我们的网站上创建个人资料时填写的信息,例如您的姓名、个人资料图片、性别、生日、人际关系状况、兴趣和爱好、教育背景和工作信息;
  5. 您在订阅我们的电子邮件和/或新闻资讯时填写的信息,例如您的姓名和电子邮箱地址;
  6. 您在使用我们网站上的服务时填写的信息;
  7. 您在使用我们的网站时生成的信息,包括您使用的时间、频率和环境;
  8. 与您购买、使用服务或通过我们的网站进行的交易相关的信息,包括您的姓名、地址、电话号码、电子邮箱地址和信用卡信息;
  9. 您在我们网站上发布的、意图发布到互联网上的信息,其中包括您的用户名、个人资料图片以及您发布的内容;
  10. 您通过电子邮件或我们的网站与我们交流时所包含的信息,包括通信内容和元数据;
  11. 您发送给我们的任何其他个人信息。

在向我们披露其他人的个人信息之前,您必须根据本政策获得被披露方的许可,才能披露和使用被披露方的个人信息

D. 使用个人信息

通过我们的网站提交的个人信息将用于本政策或网站相关页面所说明的用途。我们可能将您的个人信息用于以下用途:

  1. 管理我们的网站和业务;
  2. 为您呈现个性化的网站;
  3. 为您提供我们的网站服务;
  4. 向您发送通过我们的网站购买的商品;
  5. 向您提供通过我们的网站购买的服务;
  6. 为您发送对帐单、发票和付款提醒,并向您收取付款;
  7. 向您发送非营销用途的商业通讯;
  8. 向您发送您指定的电子邮件通知;
  9. 如果您已订阅,我们将向您发送我们的电子邮件资讯(如果您不再需要资讯邮件,可以随时告知我们;
  10. 向您发送营销资讯,包括我们的业务信息和我们认为您可能感兴趣的第三方业务,通过消息或在您同意的情况下通过电子邮件或类似技术向您发送(如果您不再需要营销资讯,可以随时告知我们;
  11. 向第三方提供有关我们用户的统计信息(但第三方无法从信息中识别任何个人用户;
  12. 处理您在我们网站上的查询或投诉;
  13. 确保我们的网站安全和防止欺诈;
  14. 检查使用我们的网站是否符合条款和条件(包括监控通过我们的网站私人信息传送服务发送的私人消息;
  15. 以及其他用途。

如果您提交个人信息以在我们的网站上发布,我们将发布您的个人信息并根据您授予我们的许可用于其他用途。

您可以通过隐私设置限制您的信息在我们网站上的发布,并可使用网站上的隐私控制进行调整。

未经您的明确同意,我们不会将您的个人信息提供给任何第三方以供其或任何其他第三方用于直接营销。

E. 披露个人信息

我们可能根据本政策中说明的用途,在合理必要的情况下,向我们的员工、管理人员、保险公司、专业顾问、代理商、供应商或分销商披露您的个人信息。

我们可能根据本政策中说明的用途,在合理必要的情况下,向我们集团的任何成员(这包括我们的子公司、最终控股公司及其所有子公司)披露您的个人信息。

我们可能会在以下情况下披露您的个人信息:

  1. 在法律要求的范围内;
  2. 与任何正在进行的或可能的法律程序有关时;
  3. 为了获得、行使或保护我们的合法权利(包括为了防止欺诈和降低信用风险,向他人提供信息);
  4. 向我们的业务或资产买方(或潜在买方)提供个人信息;
  5. 我们合理认为可能向法院或其他主管当局要求披露个人信息的任何相关方,并且法院或当局可能会要求披露个人信息。

除非本政策另有规定,否则我们不会将您的个人信息提供给第三方。

F. 国际数据迁移

  1. 我们收集的信息可能会在我们运营的任何国家/地区之间进行存储、处理和迁移,以便我们能够根据本政策使用这些信息。
  2. 我们收集的信息可能会被迁移到以下国家/地区,这些国家/地区的数据保护法律与欧洲经济区现行的法律不同:美国、俄罗斯、日本、中国和印度。
  3. 您在我们的网站上发布的信息或用于发布而提交的个人信息可能会通过互联网在全球范围内可访问。我们不能保证阻止他人使用或滥用此类信息。
  4. 您明确同意本节F中所述的个人信息迁移。

G. 保留个人信息

  1. G节列出了我们的数据保留政策和程序,旨在用于确保我们遵守有关保留和删除个人信息的法律义务。
  2. 我们出于任何目的或用途而处理的个人信息的保存时间不得超过为此目的或用途所需的必要时间。
  3. 在不影响G-2条款的前提下,我们通常会在以下日期/时间删除属于以下类别的个人数据:
    1. 个人数据类型将于7天和
    2. 30天内删除。
  4. 在本G节的另行规定下,我们仍将保留以下包含个人数据的文件(包括电子文件:
    1. 在法律要求的范围内;
    2. 如果我们认为这些文件可能与任何正在进行的或潜在的法律程序有关;
    3. 为了获得、行使或保护我们的合法权利(包括为防止欺诈和降低信用风险而向他人提供信息。

H. 个人信息的安全性

  1. 我们将采取合理的技术和有组织的预防措施,以防止个人信息丢失、被滥用或被更改。
  2. 我们会将您提供的所有个人信息存储在我们的安全(受密码和防火墙保护)服务器上。
  3. 通过我们的网站进行的所有电子金融交易都将受到加密技术的保护。
  4. 您了解并认同互联网上的信息传输本质上是不安全的,我们不能保证互联网上发送的数据的安全性。
  5. 您有责任对用于访问我们网站的密码保密;我们不会要求您提供密码(您在登录网站时除外。

I. 修订

我们可能会不时通过在我们的网站上发布新版本来更新此政策。您应该不时查看此页面,以确保您了解本政策的任何更改。我们可能会通过电子邮件或通过我们网站上的私人消息传输系统通知您有关此政策的更改。

J. 您的权利

您可以要求我们向您提供我们掌握的有关您的任何个人信息;提供此类信息应满足以下条件:

  1. 费用支付账单;
  2. 提供有效的身份证明文件(我们通常会接受由公证人证明的护照复印件以及显示当前住址的水电费帐单原件)。

在法律允许的范围内,我们可能会保留您要求的个人信息。

您可以随时要求我们不要将您的个人信息用于营销。

在实际情况中,您通常会事先明确同意我们将您的个人信息用于营销用途,或者我们会为您提供取消将个人信息用于营销用途的选项。

K. 第三方网站

我们的网站包含第三方网站的超链接和详细信息。我们无法控制第三方的隐私政策和规则,并且不对此承担任何责任。

L. 更新信息

如果我们持有的有关您的个人信息需要更正或更新,请告知我们。

M. Cookies

我们的网站使用cookie。Cookie是一个包含标识符(字母和数字的字符串)的文件,该文件由网络服务器发送到网络浏览器并由浏览器存储。浏览器每次从服务器请求页面时,该标识符就会发送回服务器。Cookies可能是“永久”Cookie或“会话”Cookie:永久Cookie将由网络浏览器存储,并且在其设置的有效期限内一直有效,除非用户在有效期限之前删除。对于会话Cookie,当关闭网络浏览器时,会话cookie将在用户会话结束时失效。Cookies通常不包含任何可以识别用户身份的信息,但是我们存储的有关您的个人信息可能会链接到存储在cookie中或从cookie获取的信息。

  1. 我们在网站上使用的cookie的名称及其用途如下:
    1. 当用户处于这些情况时:包括访问网站时/在用户浏览网站时追踪用户/在网站上使用购物车时/改善网站的可用性/分析网站的使用情况/管理网站/防止欺诈并提高网站的安全性,我们会在我们的网站上使用Google Analytics和AdWords来识别计算机;
  2. 绝大多数浏览器允许您拒绝或接受cookie,例如:
    1. 在Internet Explorer(版本10)中,您可以通过cookie设置来阻止cookie,方法是点击“工具”->“ Internet选项”->“隐私”,然后点击“高级”;
    2. 在Firefox(版本24))中,您可以通过点击“工具”->“选项”->“隐私”,从下拉菜单中选择“自定义设置历史记录”,然后取消选中“从站点接受cookie”来阻止所有cookie;
    3. 在Chrome浏览器(版本29)中,您可以访问“自定义和控制”菜单,然后依次点击“设置”,“显示高级设置”和“内容设置”,然后在“Cookies”标签页下选择“阻止网站设置任何数据”,以阻止所有Cookie ”。

阻止全部cookie将对许多网站的可用性产生负面影响。如果您阻止Cookie,则将无法使用我们网站上的全部功能。

  1. 您可以删除已存储在计算机上的cookie,例如:
    1. 在Internet Explorer(版本10))中,您必须手动删除cookie文件(可以在http://support.microsoft.com/kb/278835 上找到操作说明);
    2. 在Firefox(版本24)中,您可以通过以下方式删除Cookie:点击“工具”->“选项”和“隐私”,然后选择“自定义设置历史记录”,点击“显示Cookie”,然后点击“删除所有Cookie”;
    3. 在Chrome浏览器(版本29)中,您可以通过以下方式删除所有Cookie:访问“自定义和控制”菜单,然后依次点击“设置”->“显示高级设置”和“清除浏览数据”,然后选择“删除Cookie和其他网站”和插件数据”,然后点击“清除浏览数据”。
  2. 删除cookie将对许多网站的可用性产生负面影响。

A. Introduction

We value and are committed to protecting the privacy of website visitors. This policy details our handling of personal information.
When you visit our website for the first time, if you agree to our use of cookies in accordance with the terms of this policy, it means that you will allow us to use cookies every time you visit our website thereafter.
B. Copyright statement
This document is created based on the template of SEQ Legal (seqlegal.com).

C. Collection of personal information

The following types of personal information may be collected, stored and used:

Information about your computer, including your IP address, geographic location, browser type and version, and operating system;
Information about your visit and use of this website, including traffic sources, access time, page views and website navigation paths;
Information filled in during registration on our website, such as your email address;
The information you fill in when you create your personal profile on our website, such as your name, profile picture, gender, birthday, interpersonal relationship status, interests and hobbies, educational background and job information;
The information you fill in when you subscribe to our email and/or news, such as your name and email address;
The information you fill in when you use the services on our website;
Information generated when you use our website, including the time, frequency and environment of your use;
Information related to your purchase, use of services or transactions conducted through our website, including your name, address, phone number, email address and credit card information;
Information that you publish on our website and intended to be published on the Internet, including your user name, profile picture, and content posted by you;
Information contained when you communicate with us via email or our website, including communication content and metadata;
Any other personal information you send us.
Before disclosing the personal information of others to us, you must obtain the permission of the disclosed party in accordance with this policy in order to disclose and use the personal information of the disclosed party

D. Use of personal information

The personal information submitted through our website will be used for the purposes described in this policy or related pages of the website. We may use your personal information for the following purposes:

To manage our website and business;
To present you with a personalized website;
Provide you with our website services;
Send you goods purchased through our website;
Provide you with services purchased through our website;
Send you statements, invoices and payment reminders, and collect payments from you;
Send you commercial communications for non-marketing purposes;
Send you email notifications you specify;
If you have subscribed, we will send you our email information (if you no longer need the information email, you can tell us at any time;
To send you marketing information, including our business information and third-party businesses that we think you may be interested in, through messages or via email or similar technology with your consent (if you no longer need marketing information, Can tell us at any time;
Provide a third party with statistical information about our users (but the third party cannot identify any individual user from the information;
To handle your inquiries or complaints on our website;
To ensure the security of our website and prevent fraud;
Check whether the use of our website complies with the terms and conditions (including monitoring private messages sent through our website private messaging service;
And other uses.
If you submit personal information for publication on our website, we will publish your personal information and use it for other purposes according to the permission you grant us.

You can restrict the publication of your information on our website through privacy settings, and use the privacy controls on the website to make adjustments.

Without your explicit consent, we will not provide your personal information to any third party for direct marketing by it or any other third party.

E. Disclosure of personal information

We may disclose your personal information to our employees, managers, insurance companies, professional consultants, agents, suppliers or distributors when reasonably necessary for the purposes described in this policy.

We may disclose your personal information to any member of our group (this includes our subsidiaries, ultimate holding company and all its subsidiaries) based on the purposes described in this policy and when reasonably necessary.

We may disclose your personal information in the following situations:

Within the scope required by law;
In connection with any ongoing or possible legal proceedings;
To obtain, exercise or protect our legal rights (including providing information to others in order to prevent fraud and reduce credit risk);
Provide personal information to our business or asset buyers (or potential buyers);
We reasonably believe that any relevant party that may request the disclosure of personal information from the court or other competent authority, and the court or authority may require disclosure of personal information.
Unless otherwise specified in this policy, we will not provide your personal information to third parties.

F. International data migration

The information we collect may be stored, processed and transferred between any countries/regions in which we operate so that we can use the information in accordance with this policy.
The information we collect may be transferred to the following countries/regions whose data protection laws are different from those in the European Economic Area: the United States, Russia, Japan, China, and India.
The information you publish on our website or the personal information you submit for publication may be accessible globally via the Internet. We cannot guarantee to prevent others from using or misusing such information.
You explicitly agree to the transfer of personal information described in section F of this section.
G. Retention of personal information

Section G lists our data retention policies and procedures, which are designed to ensure that we comply with our legal obligations regarding the retention and deletion of personal information.
The personal information that we process for any purpose or purpose shall not be kept longer than necessary for that purpose or purpose.
Without affecting the terms of G-2, we usually delete personal data belonging to the following categories on the following date/time:
The type of personal data will be
Delete within 30 days.
Under the separate provisions of this section G, we will still retain the following documents containing personal data (including electronic documents:
Within the scope required by law;
If we believe that these documents may be related to any ongoing or potential legal proceedings;
To obtain, exercise or protect our legal rights (including providing information to others to prevent fraud and reduce credit risk.
H. Security of personal information

We will take reasonable technical and organized precautions to prevent personal information from being lost, misused or changed.
We will store all the personal information you provide on our secure (protected by password and firewall) server.
All electronic financial transactions conducted through our website will be protected by encryption technology.
You understand and agree that the transmission of information on the Internet is inherently insecure, and we cannot guarantee the security of data sent on the Internet.
You are responsible for keeping the password used to access our website confidential; we will not ask you for your password (except when you log in to the website.
I. Amendment

We may update this policy from time to time by publishing a new version on our website. You should check this page from time to time to ensure that you are aware of any changes to this policy. We may notify you of changes to this policy by email or through the private messaging system on our website.

J. Your rights

You can ask us to provide you with any personal information we hold about you; providing such information should meet the following conditions:

Fees to pay bills;
Provide valid identification documents (we usually accept a copy of the passport certified by a notary public and the original utility bill showing the current address).
To the extent permitted by law, we may retain the personal information you request.

You can ask us not to use your personal information for marketing at any time.

In actual situations, you will usually expressly agree in advance that we use your personal information for marketing purposes, or we will provide you with the option to cancel the use of personal information for marketing purposes.

K. Third-party websites

Our website contains hyperlinks and detailed information to third-party websites. We have no control over the privacy policies and rules of third parties and are not responsible for them.

L. Update information

If the personal information we hold about you needs to be corrected or updated, please let us know.

M. Cookies

Our website uses cookies. A cookie is a file containing an identifier (a string of letters and numbers), which is sent by a web server to a web browser and stored by the browser. Each time the browser requests a page from the server, the identifier is sent back to the server. Cookies may be “permanent” cookies or “session” cookies: permanent cookies will be stored by the web browser and will remain valid during the expiration date set by them, unless the user deletes them before the expiration date. For session cookies, when the web browser is closed, the session cookie will expire at the end of the user’s session. Cookies usually do not contain any information that can identify a user, but the personal information we store about you may be linked to information stored in or obtained from cookies.

The names and purposes of the cookies we use on the website are as follows:
When the user is in these situations: including when visiting the website / tracking the user while browsing the website / using the shopping cart on the website / improving the usability of the website / analyzing the use of the website / managing the website / preventing fraud and improving the security of the website , We will use Google Analytics and AdWords on our website to identify computers;
Most browsers allow you to reject or accept cookies, for example:
In Internet Explorer (version 10), you can block cookies through cookie settings by clicking “Tools” -> “Internet Options” -> “Privacy”, and then clicking “Advanced”;
In Firefox (version 24), you can click “Tools” -> “Options” -> “Privacy”, select “Customize settings history” from the drop-down menu, and then uncheck “Accept cookies from site”. Block all cookies;
In the Chrome browser (version 29), you can access the “Customization and Control” menu, then click “Settings”, “Show advanced settings” and “Content settings”, and then select “Block” under the “Cookies” tab The website sets any data “to block all cookies”.
Blocking all cookies will have a negative impact on the usability of many websites. If you block cookies, you will not be able to use all the features on our website.

You can delete cookies that have been stored on your computer, for example:
In Internet Explorer (version 10), you must manually delete the cookie file (the operating instructions can be found at http://support.microsoft.com/kb/278835);
In Firefox (version 24), you can delete cookies in the following ways: click “Tools” -> “Options” and “Privacy”, then select “Customize settings history”, click “Show Cookies”, and then click “Delete All Cookies”;
In the Chrome browser (version 29), you can delete all cookies by visiting the “Customize and Control” menu, then click “Settings” -> “Show advanced settings” and “Clear browsing data”, then select “Delete cookies and other sites” and plug-in data”, and then click “Clear browsing data”.
Deleting cookies will have a negative impact on the usability of many websites.

分类
科技文章

javascript human file size

function humanFileSize(bytes, dp = 2) {
    const thresh = 1024;

    if (Math.abs(bytes) < thresh) {
        return bytes + 'B';
    }

    const units = ['KB', 'MB', 'GB'];
    let u = -1;
    const r = 10 ** dp;

    do {
        bytes /= thresh;
        ++u;
    } while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);

    return bytes.toFixed(dp) + units[u];
}
分类
科技文章

新建Developer ID Application 报错

报错:You already have a current Developer ID Application certificate or a pending certificate request.

Developer ID只能创建5个,新建超过5个时就会出现以上报错,而且开发者账号网站上Developer ID也不能revoke,如果revoke了Developer ID,之前用此证书签名的APP就无法再安装了。

Developer ID证书创建之后一定要注意备份,是可以重用的。

分类
科技文章

发布Electron App到Mac App Store

原文链接,此文在原文基础上有补充。

此文章基于Catalina新版发布规则撰写。

你有两种选择来发布适用于MacOS的Electron App。一种是直接发布(请参阅对Electron App进行公证),或通过Mac App Store(MAS)发布。通过MAS分发的所有应用程序都必须进行沙盒处理(sandbox),这意味着除已批准的权利(entitlements)外,它们完全独立。Mac的Catalina OS于2019年10月发布,添加了许多影响沙盒应用程序的更改,导致许多现有的Electron应用程序崩溃并拒绝了新应用程序。 要使基本应用程序成功提交以供审核并批准在Mac App Store上分发,您需要执行以下步骤。

1. 从已经开发完成的Electron App开始

必须使用Electron版本8.0.2或更高版本(或修补版本6.1.7和5.0.13),因为早期版本使用Apple不再允许的私有API。 Electron应该是dev(或global)依赖,而不是production依赖。

npm install -D electron

2. 苹果开发者账号

必须要有苹果开发者账号,需要付费600多一年。在developer.apple.com注册。

3. 创建两个签名证书

每个证书创建需要两步。

3.1 3rd Party Mac Developer Application 证书

3.1.1 请求证书

  • 打开钥匙串访问(位于 应用程序 > 实用工具)
  • 点击菜单 > 证书助理 > 从证书颁发机构请求证书
  • 在弹出的证书助理窗口中,填写用户电子邮件地址
  • 填写常用名称(例如3rd Party Mac Developer
  • CA电子邮件地址留空
  • 选择存储到磁盘,点击继续
  • 选择存储目录后,会存储文件名CertificateSigningRequest.certSigningRequest

3.1.2 导入证书到苹果开发者账号

  • 访问https://developer.apple.com/account > Certificates, IDs & Profiles > + (to add a new certificate) > Mac App Distribution > continue > Choose File > 选择刚刚生成的文件(CertificateSigningRequest.certSigningRequest) > continue > Download > 双击下载的文件(mac_app.cer),会自动加载到钥匙串。
  • 注意:在开发者账号网站中显示的名称是Mac App Distribution,加载到钥匙串之后显示的名称是3rd Party Mac Developer Application: {name} (XXXXXXXXXX),它们是相同的证书。
  • 删除CertificateSigningRequest.certSigningRequest文件。

3.2 3rd Party Mac Developer Installer 证书

大致重复3.1中的流程

3.2.1 请求证书

  • 打开钥匙串访问(位于 应用程序 > 实用工具)
  • 点击菜单 > 证书助理 > 从证书颁发机构请求证书
  • 在弹出的证书助理窗口中,填写用户电子邮件地址
  • 填写常用名称(例如3rd Party Mac Developer
  • CA电子邮件地址留空
  • 选择存储到磁盘,点击继续
  • 选择存储目录后,会存储文件名CertificateSigningRequest.certSigningRequest

3.2.2 导入证书到苹果开发者账号

  • 访问https://developer.apple.com/account > Certificates, IDs & Profiles > + (to add a new certificate) > Mac Installer Distribution > continue > Choose File > 选择刚刚生成的文件(CertificateSigningRequest.certSigningRequest) > continue > Download > 双击下载的文件(mac_installer.cer),会自动加载到钥匙串。
  • 注意:在开发者账号网站中显示的名称是Mac Installer Distribution,加载到钥匙串之后显示的名称是3rd Party Mac Developer Installer: {name} (XXXXXXXXXX),它们是相同的证书。
  • 删除CertificateSigningRequest.certSigningRequest文件。

查看证书

  • 在钥匙串中查看证书:打开钥匙串访问,点击“登录”,点击“我的证书”,刚刚导入的两个证书应该在列表中,名称是3rd Party Mac Developer Application: {name} (XXXXXXXXXX) 。个人开发者的name就是你的名字。
  • 在苹果开发者账号网站上查看:https://developer.apple.com/account/ > Certificates, IDs, & Profiles menu > Certificates menu > Mac App Distribution and Mac Installer Distribution 两种类型的证书在列表中可见。

证书备份

注意:如果更换了开发用的Mac电脑,需要备份证书再导入新设备才可以使用本次生成的证书,否则只能重新生成,之前导入到苹果开发者网站的证书下载导入钥匙串之后会显示缺少私钥,而且网站上可保留的证书数量很有限,想添加多的,只能先revoke以前的。备份的证书需要选择p12格式,包含公钥和私钥,可以设置密码保护。把备份的证书妥善保管,以备更换设备或者切换设备使用。备份操作在证书列表右键,选择导出,按操作提示执行即可。

4. 创建 App ID

  • Go to your developer account – developer.apple.com > Certificates, IDs & Profiles > Identifiers > + (to add a new id) > select App IDs > continue button.
  • On the Register App ID page:
    • Platform: MacOS
    • Bundle ID: Explicit. Apple recommends using a reverse-domain name style string (i.e., com.domainname.appname). This does not need to correspond with an actual website. This will need to match the appId property in the package.json file.
    • When done click continue, review it, then click register.

5. 在开发者账号中新建App

引用:https://help.apple.com/app-store-connect/
官方文档: help.apple.com/app-store-connect/#/dev2cd126805

此部分稍后再写,也有很多注意事项。

6. Create an icon set

参考:
https://www.electron.build/icons
https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/app-icon

此部分稍后再写

7. package.json文件

斜体字的值需要更改为你的信息。

{ 
  "name": "AppName",  
  "version": "1.0.0", 
  ...
  "author": "AuthorName", 
  "build": {  
    "appId": "com.companyname.appname",
    "productName": "App Name with spaces & special characters", 
    "buildVersion": "1",
    "copyright": "Copyright © 2020 Developer/Company Name", 
    "mac": {  
      "category": "public.app-category.categoryName", 
      "icon": "build/icon.icns",  
      "target": "mas",  
      "hardenedRuntime": false, 
      "entitlements": "build/entitlements.mas.plist", 
      "entitlementsInherit": "build/entitlements.mas.inherit.plist",  
      "provisioningProfile": "MacAppStore.provisionprofile",  
    } 
  } 
} 

参考文档:

一些注意事项:

  • nameproductNamename将用作您应用在用户计算机上的显示名称。它不能包含空格或特殊字符。如果要在name中使用空格或特殊字符,请在build键中添加一个productName键。 您可以设置其名称,使其显示在Mac App Store的appstoreconnect.apple.com上。
  • versionbuildVersion:package.json中的version应与appstoreconnect.apple.com上的应用程序的版本号相对应。如果您将应用程序上传到appstoreconnect,但在决定将其提交审核之前进行更改,则无法删除上传的内容。此时需要设置不同的buildVersion,重新构建之后上传。
  • appId:使用之前在开发者账号网站中创建的App ID
  • category键应与您在appstoreconnect.apple.com中为App设置的category一致。List of possible categories
  • target需要设置为mas
  • hardenedRuntime需要设置为false。如果要将app分发到MAS之外,则可以将其设置为true。参考:developer.apple.com/documentation/security/hardened_runtime_entitlements