EventKit Predicate Choices - iphone

The app I'm developing will write events to a calendar on the user's phone. I was thinking of preceeding my app's event with a prefix like myapp: so I can find my events in the event store to display in a tableview.
However, it seems that the only predicate available is based upon a start and end date (– predicateForEventsWithStartDate:endDate:calendars:) when I review the ios eventkit framework. Am I reading that right?
Should I just then create a calendar for just my app on the phone or is there another way to identify my events beside dates?
Thanks in advance.

One other option would be to have local storage (sqlite, coredata etc...) which indexes into the event. Each event has as event id and you can you retrieve the event from the store via eventWithIdentifier.
Not sure what your data access patterns are but that also allows you to quickly store data within your app that you can query effieciently (with a powerful predicates and sql syntax). Your local results could just return eventIds and in the the table view call backs you get the id for that row and retrieve from the events store.
Just another option ...

Related

Determine source of Database Event in Firebase RealTime Database and Flutter

I have a Flutter app using Firebase Realtime database. I have created subscriptions to add, change, and delete for a node.
I would like to determine if the DatabaseEvent received for these subscriptions was generated by the local application, or by something else (for example, a direct edit using the Firebase Console.)
I know I could probably store some information when I issue the database add, change or delete, and then when I receive the event compare to see if the same item referenced, but I was hoping to see if there was some information in the Event itself (or somewhere else) that would tell me this.
Anyone have an idea?
I have examined the DatabaseEvent object returned when the subscriptions fire, but I don't see any information that could help.
firebaser here
There is nothing built in for this in the Firebase Realtime Database SDK or in any of its other APIs. If you want to know the source of the data, you'll have to track it yourself.
One of our early demo apps for a shared whiteboard held a list of the push keys for all its pending writes, so that it could filter those in its listener (as it had already drawn the local strokes before even sending them to the database). But there are many other valid approaches for this too.

Sync EventKit events with remote database

I would like to create an app that retrieves events (similar to calendar events) from a remote database and shows them in a View, create, edit and delete new or existing events; currently I’m using EventKit framework to access iOS calendar, I read this docs and tried SimpleEKDemo:
https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/EventKitProgGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009765
I actually can get events from server through an HTTP POST request (a NSMutableURLRequest) with JSON response and show them in a tableView, when I tap on an event I can edit it, update the remote db entry and if I switch to iOS calendar I see the event (so writing in calendar database is successful);
the most important thing is that all events must be synchronized with remote database, so the core problem occurs when user leaves my app, opens iOS calendar and edits an event previously created through my app: in this case the synch does not occur and the data are inconsistent.
I was thinking at these possible ways:
Is there a way to hook at iOS Calendar so I can perform update in remote db, only for a subset of events?
Or can I create an event only editable through my app?
Maybe do I have to quit EventKit and create a custom calendar with custom update functions?
I read also these questions:
Create a calendar in iOS
How to identify EKEvent uniquely with Sync across the devices
Sync database on ipad with remote database
but I don't know if I'am on the right track.
Any help is appreciated, thank you.
EDIT: with "synchronized" I mean that all data on the app database must be the same as server database
At least today you cannot create a custom protocol provider for the iOS calendar, which I think is what you are asking for (you would like to feed the calendar backend with your JSON-like protocol, or some app extension translating that).
There are three options:
a) keep the remote database in sync using an application
b) write your own calendar UI
c) implement CalDAV on the server side, or in a proxy
It sounds like a) is what you are doing today. You would need to sync the EventKit database when your app starts (to pickup changes done in other EventKit apps like Calendar). Obviously the user needs to start your app once in a while to get the sync going ... (as a hack you might also be able to trigger your app using a push)
Depending on your needs b) is a lot of work and you have zero platform integration.
I think implementing CalDAV in your server, or adding a proxy which translates between your server's JSON and CalDAV is probably the best way to go. You can then just add your server as a CalDAV account to iOS. As a bonus you can use any other client doing CalDAV with your server ...

Access Record record - show lock status

I use a datasheet view of a query with aggregate sub queries attached as fields. Of course this is not editable and that is fine as its merely an overview listing of all the records along with some sum information from related tables. I have noticed that when a query is not editable the record selector lock information is not displayed. This made me wonder.
Is there is some event that can be captured to display in more or less real time when a record is locked or released by other users?
Alternatively is there any other way to display in my overview list or elsewhere what records are currently locked and if possible by what user?
Access 2010(x64)
For an updatable query, the locked status may be displayed on the left margin as you have noted. But that reflects record-locking by the query engine, not the same thing as whether a data result is updateable under normal circumstances.
For a read-only query, Access won't show a lock icon because in that context it isn't useful information (from most people's point of view).
You could use VBA to check the attribute of the query as a whole, and display a notification when the form is loaded. But that doesn't relate to the record-locking icon.
Is there is some event that can be captured to display in more or less real time when a record is locked or released by other users? -- I believe the simple answer is no.
Access 2007 saw the end of the JET Security model, so there is no way for you to manage user-level security in files created using 2007 or later.
The only alternative would be to use the Win API to register users by their NT ids, and to develop your own model which responded to activity. Clearly this would be no mean feat!
[Edit]
As for detecting record locks, it's possible you could implement this using an events handler class together with the ADO library:
http://msdn.microsoft.com/en-gb/library/windows/desktop/ms678373%28v=vs.85%29.aspx
If you don't mind getting your hands dirty with Class Modules (something some pundits never got to grips with), then you can find a lead-in here.

Retaining Events from the user's calendar

I'm working on an App that needs to remember events selected by the user from their calendar and I've run into a problem with recurring events.
For non-recurring events I can just store the eventIdentifier and fetch the event from the Event Store when I need it.
But recurring events all share the same eventIdentifier. When I go back to the Event Store to fetch the event (based on the eventIdentifier) I get the very first event in the recurrence chain ... not the Nth recurrence of the event that the user selected.
I can't persist the user selected events by archiving the entire EKEvent object since EventKit doesn't support NSCoding.
I'm considering storing the eventIdentifier and Start & End dates so that I can fetch the correct event from the Event Store ... but that seems pretty kludgy and might make tracking changes the user makes in their calendar between launches of my App tricky.
Any thoughts or suggestions?
The event identifier alone is not enough even for non recurring events. Indeed, it can change when the user moves the event to a different calendar. For recurring events, it may change upon detaching an occurrence or splitting the recurrence.Therefore, it is common practice to search for events using a subset of information (say title, start and due date). You should not rely on event identifiers.
Unfortunately, the framework does not provide us with the raw data of an event, it just provides all of the occurrences of the events in a specified interval. Therefore, there is no such thing (using the framework) as the possibility of retrieving a single recurring event and then expanding its recurrence to get its n-th occurrence: you need to manually post-process the retrieved events in order to find the ones you are interested to.
The problem here is that the APIs provided are not meant for sync purposes. Many developers have complained and still complain about this by filing a bug/feature request using Radar. Until now, Apple answer about is that the APIs fulfill a different purpose, since sync is automatic. However, this is true when syncing through iTunes, but not programmatically.

Overwrite database or update (iPhone)?

I have a content based, read-only iPhone app. Users can select favorite topics, which I need to track. Some topics I'd like to make available between app updates through the App Store. I'll need to track if users have downloaded these particular topics or not until the App Store update is available. This approach will consist of two tables for user tracking. All other tables contain mainly static content, save any new downloaded entries.
Before I began tracking user content, I'd always deploy the database on app updates. An overwrite - simple. But now I need to track certain user configurations. Rather than trying to keep track of which app version a user has and running through a list of sql scripts in the correct order, so the user is at the right database version, I'm thiking to use two databases. One contains static content and the other user data. The static content database is always overwritten. That keeps things simple. The database currently is 250kb. It will grow very slowly.
I have plans to use SDK 3.0 push notification and peer-to-peer as well, which will store any user config data in the user database.
Any one see problems with this approach?
This sounds alright to me. If you're using SQLite, you may want to look into the ATTACH DATABASE command, which lets you keep two databases open on the same connection.