[英]Installing OpenSSL library for Xcode
I have installed OpenSSL in xcode for receipt validation, but it doesn't work. 我已经在xcode中安装了OpenSSL以进行收据验证,但是它不起作用。
I download openssl.xcodeproj
and openssl-1.0.1f
. 我下载了
openssl.xcodeproj
和openssl-1.0.1f
。 I extract openssl-1.0.1f and add openssl.xcodeproj
to my project. 我解压缩openssl-1.0.1f并将
openssl.xcodeproj
添加到我的项目中。
I edit the Header Search Path
to : 我将
Header Search Path
编辑为:
/Users/marko/Documents/Razvoj/BIView\ Mobile\ New\ Version/openssl/include/openssl
I added libcrypto.a
in Target Dependencies
under Build Phases 我在构建阶段的
Target Dependencies
添加了libcrypto.a
and added libcrypto.a
in Link Binary With Libraries
并在
Link Binary With Libraries
添加了libcrypto.a
as was described in http://atastypixel.com/blog/easy-inclusion-of-openssl-into-iphone-app-projects/ . 如http://atastypixel.com/blog/easy-inclusion-of-openssl-into-iphone-app-projects/中所述 。
But when I build project it stops with error : 但是当我构建项目时,它会因错误而停止:
clang: error: no such file or directory: '/Users/ .... -bmgslnakszsfovecplbzoslykrxo/Build/Products/Debug-iphoneos/libcrypto.a'
Why ? 为什么呢
OK, how to build and install it....
OK,如何构建和安装它。
It might be easier to use a pre-built version of OpenSSL for iOS. 使用iOS的OpenSSL的预构建版本可能会更容易。 You can find one at this Github account .
您可以在这个Github帐户中找到一个。 The OpenSSL from that Github are multi-arch.
该Github的OpenSSL是多架构的。 They have ARMv7, ARMv7s, ARM64, and i386.
它们具有ARMv7,ARMv7s,ARM64和i386。 That means they work with devices and simulators.
这意味着他们可以使用设备和模拟器。
Download either OpenSSL 1.0.1e or 1.0.1f. 下载OpenSSL 1.0.1e或1.0.1f。 Install it in a location like
/usr/local/ssl/ios
. 将其安装在
/usr/local/ssl/ios
。
Then, add the headers to your Xcode project. 然后,将标题添加到您的Xcode项目中。 They are located in
/usr/local/ssl/ios/include
: 它们位于
/usr/local/ssl/ios/include
:
Finally, add the multi-arch libs ( libcrypto.a
and libssl.a
) to your Xcode project. 最后,将多
libssl.a
库( libcrypto.a
和libssl.a
)添加到您的Xcode项目中。 They are located in /usr/local/ssl/ios/lib
: 它们位于
/usr/local/ssl/ios/lib
:
You need to add the library as a Framework. 您需要将库添加为框架。 See this question: how to add an existing framework in Xcode 5 .
看到这个问题: 如何在Xcode 5中添加现有框架 。
Its OK to add the OpenSSL libraries under Frameworks. 可以在Frameworks下添加OpenSSL库。 Its how things are done under Apple/Xcode.
它在Apple / Xcode下的工作方式。
I use the Absolute Path like in the image below because Crypto++, OpenSSL, etc are installed in /usr/local
. 我使用下图所示的绝对路径,因为Crypto ++,OpenSSL等安装在
/usr/local
。 The image below is a screen capture I have handy of Crypto++, and not OpenSSL's libcrypto.a
or libssl.a
. 下图是我方便使用Crypto ++的屏幕截图,而不是OpenSSL的
libcrypto.a
或libssl.a
。 But the same applies to all libraries. 但是所有的库都一样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.