For conceptual information about this feature, see Integration of the Automatic Configuration Update.
Using the ShieldSDK APIs, you can manually request an updated configuration instead of waiting for an unexpected termination of the app to trigger the update. The APIs also allow you to set the custom identifier for the X-update-custom-id header and receive callbacks when the app successfully downloads a new configuration. If set, the custom identifier must be a valid HTTP header value. App Shielding will not send HTTP headers with invalid characters. Therefore, it is recommended that custom identifiers use Base64 or Base16 (i.e., hex) encoding.
Integration of the iOS SDK API
First, add the SDK/C/ShieldSDK.xcframework bundle from the App Shielding package to your project and include the ShieldSDK/config_update.h header. You can then use the following functions:
Function | Description |
|---|---|
| Triggers App Shielding to check for and download a new configuration. The request is performed in the background, so the function returns immediately. |
| Retrieves the internal timestamp value of the currently active configuration as an |
| Sets the |
| Registers a callback struct with a |
When using the
downloadedcallback, be mindful of the following:
The callback might be called on an arbitrary thread. Dispatch to the main queue before performing any UI work from it.
The callback cannot be unregistered, so the context pointer passed to
prm_config_set_cb()must remain valid for the lifetime of the application.
Example
The following example sets a custom ID, registers a callback, and requests an update:
#include <ShieldSDK/config_update.h>
...
static void
on_config_downloaded(void *ctx, int64_t timestamp)
{
(void)ctx;
// handle callback logic
...
}
void
shield_config_init(void)
{
struct prm_config_cbs cbs = {
.downloaded = on_config_downloaded,
};
prm_config_set_cb(NULL, cbs);
prm_config_set_id("my-token");
prm_config_request();
}