how to add openssl to a swift project

我的未来我决定 提交于 2019-12-19 07:35:13

问题


I am learning how to add in-app purchase receipt validation to my iOS/OSX projects.

There is a nice overview here and the WWDC14 has good videos on this topic.

Plenty of sample code, but everyone skips one step. How to import the openSSL header. The swift compiler complains that there is no such module.

import Foundation
import StoreKit
import openssl  //no such module ???

I am already stuck before writing one line of code. Where is the openssl framework hiding?


回答1:


There is no OpenSSL module built in. You have to compile it yourself - this is for security so that everyone doesn't implement the exact same security.

Take a look at : https://gist.github.com/foozmeat/5154962 http://www.cvursache.com/2013/08/13/How-To-Build-openssl-For-iOS/

There is a also a cocoapods at http://cocoapods.org/?q=openssl

You should never use a static module provided by someone else. Always build your own.

Apples official explanation here - under OpenSSl - https://developer.apple.com/library/ios/documentation/Security/Conceptual/cryptoservices/GeneralPurposeCrypto/GeneralPurposeCrypto.html



来源:https://stackoverflow.com/questions/31380713/how-to-add-openssl-to-a-swift-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!