要在 64 位 iOS 设备上安装 OpenSSL,您必须将 libcrypto.a 和 libssl.a SSL 库文件复制到您的系统。下载 iOS OpenSSL .zip 文件,解压后在 \lib 目录中找到 .a 文件。您必须将 libcrypto.a 和 libssl.a SSL 库文件复制到以下目录:
C:\Program Files (x86)\Embarcadero\Studio\<IDE Version>\lib\iosDevice64\debug
C:\Program Files (x86)\Embarcadero\Studio\<IDE Version>\lib\iosDevice64\release
将 sgcIdSSLOpenSSLHeaders_static (or IdSSLOpenSSLHeaders_static if your sgcWebSockets edition is not Enterprise) 单元添加到您的 uses 子句中。
若需要部署任何文件,可将 RemotePath = StartUp\Documents,并使用以下方法加载文件(需在 uses 子句中添加 System.IOUtils):
TPath.GetDocumentsPath + PathDelim + <您的文件名>
不得通过 iOS 下的菜单 Project/Deployment 部署 openSSL 库。
修改 IdCompilerDefines.inc 并在 IOS 部分启用 SGC_OPENSSL_API_1_1:
{$IFDEF IOS}
{$DEFINE HAS_getifaddrs}
{$DEFINE USE_OPENSSL}
{$IFDEF CPUARM}
// RLebeau: 对于 iOS 设备,OpenSSL 不能作为外部库使用,
// it must be statically linked into the app. For the iOS simulator, this
// is not true. Users who want to use OpenSSL in iOS device apps will need
// 将静态 OpenSSL 库添加到项目,然后引入
// IdSSLOpenSSLHeaders_static unit in their uses clause. It hooks up the
// IdSSLOpenSSLHeaders 单元使用的静态链接函数...
{$DEFINE STATICLOAD_OPENSSL}
// sgc--> 为 openssl API 1.1 启用
{$DEFINE SGC_OPENSSL_API_1_1}
{$ENDIF}
{$ENDIF}
您可以从您的账户下载库。
修改 IdCompilerDefines.inc,在 IOS 部分启用 SGC_OPENSSL_API_1_1 和 SGC_OPENSSL_API_3_0:
{$IFDEF IOS}
{$DEFINE HAS_getifaddrs}
{$DEFINE USE_OPENSSL}
{$IFDEF CPUARM}
// RLebeau: 对于 iOS 设备,OpenSSL 不能作为外部库使用,
// it must be statically linked into the app. For the iOS simulator, this
// is not true. Users who want to use OpenSSL in iOS device apps will need
// 将静态 OpenSSL 库添加到项目,然后引入
// IdSSLOpenSSLHeaders_static unit in their uses clause. It hooks up the
// IdSSLOpenSSLHeaders 单元使用的静态链接函数...
{$DEFINE STATICLOAD_OPENSSL}
// sgc--> 为 openssl API 1.1 启用
{$DEFINE SGC_OPENSSL_API_1_1}
// sgc --> 为 openssl API 3.0 启用
{$DEFINE SGC_OPENSSL_API_3_0}
{$ENDIF}
{$ENDIF}
您可以从您的账户下载库。