BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Parse Announces Local Datastore for iOS and Crash Reporting Service

Parse Announces Local Datastore for iOS and Crash Reporting Service

Leia em Português

MBaaS (Mobile Backend as a Service) provider Parse recently announced two new additions to its platform, a crash reporting service and support for local data storage on iOS.

As a mobile backend as a service provider Parse aims to simplify  app development by automating the creation of server side aspects of apps.  This in turn allows developers to focus on the visual appearance and user experience of their apps.  Developers using the Parse platform gain access to a scalable backend with support for data storage, authentication (including social login), custom code execution in the cloud (using JavaScript), server-side scheduled background tasks, a push notification service and an analytics dashboard.  

As of last week’s announcement the Parse platform now also allows developers to monitor app crashes.  This addition will be welcomed by developers, who previously had to administer and pay for additional crash reporting tools such as Crashalytics, Crittercism and TestFlight.  Like the aforementioned tools the Parse Crash Reporting Service provides a dashboard with support for aggregating similar crashes, tracking crashes across versions and symbolication of stack traces.  

Developers can easily integrate crash reporting into their apps by calling the appropriate method in the platform specific Parse SDK.  On iOS developers should make the following call in their app’s AppDelegate class:

[ParseCrashReporting enable];

On Android developers should add the following call to their Application class’ onCreate method:

ParseCrashReporting.enable(this);

Aside from crash reporting Parse also announced support for local data storage on iOS (previously available on Android only).  With local data storage developers can cache app data on the client device and synchronize it at a later date.  This resolves a common problem faced by mobile app developers, a lack of a reliable internet connection, which often results in a frustrating user experience.

Parse’s local data storage API uses the concept of pinning to identify API query results that should be retained offline, in the local datastore.  Pinned objects are automatically updated when future save, update or delete API calls are made.  The following code sample illustrates pinning a Parse backend query and subsequently querying the local datastore for the cached results:

PFQuery *query = [PFQuery queryWithClassName:@"Feed"];
 
// Pin PFQuery results
NSArray *objects = [query findObjects]; // Online PFQuery results
[PFObject pinAllObjectsInBackground:objects];
 
...
 
// Query the Local Datastore
[query fromLocalDatastore];
[query whereKey:@"starred" equalTo:@YES];
[[query findInBackground] continueWithBlock:^id(BFTask *task) {
// Update the UI
}]];

In addition to caching API responses the local datastore can be edited, with changes to items being synchronized once an internet connection becomes available.  The following code sample illustrates using the local datastore APIs to retrieve and update a cached object:

feedItem.starred = YES;
 
// No network connectivity
[feedItem saveEventually];
 
...
 
PFQuery *query = [PFQuery queryWithClassName:@"Feed"];
[query fromLocalDatastore];
[query whereKey:@"starred" equalTo:@YES];
[[query findInBackground] continueWithBlock:^id(BFTask *task) {
// "feedItem" PFObject will be returned in the list of results
}]

Developers wishing to trial the Parse platform can avail of its free tier, which allows up to 30 API requests per second, 20GB of storage and 2TB of data transfer per month.  Paid for plans are availale at $100 increments, starting at $100 per month and ranging upto $3,700 per month, with increased API request, data storage and transfer limits at each increment.  Full pricing information is available on the Parse plans page.

Rate this Article

Adoption
Style

BT