How to use CommonCrypto in iOS

Issue #480

Use modulemap

modulemap approach

I use modulemap in my wrapper around CommonCrypto https://github.com/onmyway133/arcane, https://github.com/onmyway133/Reindeer

For those getting header not found, please take a look https://github.com/onmyway133/Arcane/issues/4 or run xcode-select --install

  • Make a folder CCommonCrypto containing module.modulemap
module CCommonCrypto {
  header "/usr/include/CommonCrypto/CommonCrypto.h"
  export *
}
  • Go to Built Settings -> Import Paths
${SRCROOT}/Sources/CCommonCrypto

Cocoapods with modulemap approach

public header approach

Cocoapods with public header approach

1
2
s.libraries        = "xml2"
s.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2', 'OTHER_LDFLAGS' => '-lxml2' }

🐝 Interesting related posts

CommonCrypto from Xcode 10

From Xcode 10, we can just

1
import CommonCrypto

Code

Comments