- "sqlite3.h", "sqlite3.c" & “sqlite3ext.h” filename should all have the prefix of “keen_io” as the latter are version ambiguous.
- “KIOEventStore.h" should import "keen_io_sqlite3.h” and not “sqlite3.h” which is ambiguous.
- The distribution zip (cocoa pods or not) should include the "keen_io_sqlite3.h” as it is imported by “KIOEventStore.h"
- The usage of NSDateFormatter is not thread-safe (https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html). A better and much faster solution would be (as you have sqlite now) to simply execute something like:
sqlite3_stmt *statement = NULL;
sqlite3_prepare_v2(db, "SELECT datetime('now');", -1, &statement, NULL);
sqlite3_bind_text(statement, 1, format, -1, SQLITE_STATIC);
sqlite3_step(statement);
char *value = (char *)sqlite3_column_text(statement, 0);
NSString *string;
if (value) {
string = [NSString stringWithUTF8String:value];
}
Which is thread safe - as you can have a memory file sqlite connection open as SQLITE_CONFIG_MULTITHREAD
(just for the date formatting) because no data is written or read from that connection (that’s how we do it in our app).
sqlite3_open(":memory:", &db);
Or you can just open and close it on every request if you wish.
- It's 1400% faster (!!!) you can read all about it in: http://vombat.tumblr.com/post/60530544401/date-parsing-performance-on-ios-nsdateformatter-vs
- And you can tweak the output of the string as defined in here: http://www.sqlite.org/lang_datefunc.html
- The library log version print is problematic, as
[KeenClient isLoggingEnabled]
will only be set or relevant after the init (as we, the end users, are probably using shared instance). A better solution IMHO would be to have it print on every set (if its enabled) and also to allow the user the ability to read the kKeenSdkVersion as a class method.