Overview This directory contains an iOS testing harness that can be run on osx and ios. Under the hood our client libraries can be built as a staticlib and c bindings are exposed via FFI. This enables the library to be linked with an iOS application build.
The primary method for xcode to link external libraries is via a concept called XCFramework. We generate an XCFramework when building for iOS, it is stored in the target/aarch64-apple-ios/release
directory. See the makefile for more details.
Usage
- Ensure xcode is installed
- Setup local notary via the notary docs
- Open xcode and the
client_ios/demo
project - Run
make ios-sim
if running in the simulator, ormake ios
for on device testing - Return to xcode and select
Product > Run
orcmd+R
- Click
setup tracing
to enable logging, thengenerate proof
Module Map Files XCode relies on a concept called modules which use a modulemap file to describe the connection between a standalone C library and a swift or objective-c application.
Web prover use a default module map file which simply exposes are library as a framework called Prover
, exposed c-bindings can be called on this interface.
Linking dependencies
Our static library depends on the -lstdc++
or -lc++
library, link either when using xcode. The default project settings in the demo harness should already link this library.
If it has not been linked, you may see a linking error such as:
error build: Undefined symbol: std::exception::what() const
To remedy:
- Open xcode
- Select Demo > Build Settings > Other Linker Flags
- Click
+
and add-lstdc++
as a flag
Listing linking dependencies
The rust compiler has a special flag --print=native-static-libs
for listing the linking dependencies of a static library. This can be helpful for identifying missing linker flags.
To use:
- Run
cargo clean
(the command only works when rustc builds) - Prepend
RUSTFLAGS="--print=native-static-libs"
to the cargo build command for the ios target. - Search for
native-static-libs:
to view a list of linker flags
For example, this output was shown at testing time:
note: native-static-libs: -framework Security -framework CoreFoundation -lc++ -liconv -lSystem -lc -lm
Most of these appears to already be linked by xcode, but -lc++
in particular was missing.
Local certificate chain
The demo harness has been setup to work with localhost services using TLS, this requires loading a certificate into the TLS client. It currently relies on the demo/ca-cert.cer
, this is identical to the certificate in the fixtures directory.
If that certificate changes, both will need updated.