Iglu Objective-C Client 0.1.0 released
We are pleased to announce the release of version 0.1.0 of the Iglu Objective-C Client. This is the second Iglu client to be released (following the Iglu Scala Client) and will allow you to test and validate all of your Snowplow self-describing JSONs directly in your OS X and iOS applications.
The rest of this post will cover the following topics:
- How to install the client
- How to use the client
- Why you should use the client
- Getting help
1. How to install the client
The release version of this Client can be found on cocoapods under
SnowplowIgluClient. Assuming you are already using CocoaPods, installation from there is as simple as:
pod 'SnowplowIgluClient'to your Podfile
pod updateto pull in the new dependency
For steps on manual installation refer to our setup guide.
To use the library you will need to add the following import:
And that’s it! You’re now ready to start using the Client.
2. How to use the client
The client needs two arguments for a successful init; a resolver config and a possibly-empty array of
- The former can be passed either as an
NSStringor as a URL path which the client will then download for you
- The latter is a set of additional embedded repositories, alongside the one that comes bundled with the client
To initialize the client with a local resolver-config from local resources:
To initialize the client with a resolver from a URL:
Once you have successfully created a client you can start validating JSONs. Please note that the client will only accept JSONs that have already been converted to NSDictionary objects.**
Currently the underlying library for JSON Schema validation does not support full error logging so you will only be able to see a
NO result for the validation. To see the full validation error, we recommend pasting the offending JSON and associated JSON Schema into this online validation tool.
That is all there is to it! For more information please refer to the technical documentation.
3. Why you should use the client
This library lets you add a layer of JSON validation to your iOS and OS X apps.
Due to the length of time it takes to push an app to the App Store, it is especially important to check that the self-describing JSONs you are sending to Snowplow will not cause validation issues downstream. If they do not validate, then Snowplow events will fail validation until you can get the problem fixed.
You can now run the following assertions directly in your application:
- That your resolver config is valid as per the Iglu technical documentation
- That your self-describing JSONs can be resolved correctly against your Iglu repositories
- That your self-describing JSONs pass validation against their respective JSON Schemas
This removes the need of manually and painstakingly validating that your events and corresponding JSON Schemata are correct.
For example imagine you are creating an event named
awesome-event which you want to track in your application.
You then generate the JSON Schema for this event using Schema Guru:
You can now use the Iglu Client in your test suite to assert that whenever you make an
awesome-event, it validates against the schema you have created:
If for whatever reason the event is missing a required value or is not formed exactly right, then your tests will fail, giving you fair warning that you should not release this version to the App Store.
You can find the Iglu Objective-C Client on our wiki.