Parse Local Data Store Inconsistency - ios

I am facing an inconsistency on Local Data Store on iOS , that 4 out of 10 attempt will be unable to retrieve the pinned data and get Error: This object is not available in the offline cache. When I request and pinned the data , it was available , but after few load, then the data was not able to retrieve, there is no code changes nor data updates, purely playing around offline. (I am unable to track this , because this occur inconsistently ).
Please kindly assist in troubleshooting this or suggest what should I do with it. I am using Local Data Store to store all major data of my app, and also did download the images related after pinned, I wonder is it because of storage limit by parse ? or something like auto clean out the pinned object ?

You say that you are using Local Data Store for all the major data in your app. I presume you are using PFFile for the large data (like images), as per Parse's recommendation. If so, these do not persist in local datastore.
See here : pffiles in local datastore

Related

Should i save images to local storage in iOS App?

I am working on a project where i want to make the data, text, images available in offline mode as well.
I fetch data from a web-service which includes image urls and other data. I store the text data in core data entities, however i don't save images locally but fetch them in realtime.
To view images in offline mode i will have to save them to local storage. However i am wondering if it would be the right approach. Saving images to local may possibly eat up a lot of storage on user's device.
What is the best approach to address this problem?
Should i save images to local or should i fetch them on run time only?
Use NSCache. With NSCache you can set a limit to how many images and so on are cached. See Apple's documentation for more details: https://developer.apple.com/reference/foundation/nscache?language=objc
Edit:
Never mind NSCache, just save the images as files. NSCache can still save you network usage and allow your app to be more responsive, but it is not what you want.
Should i save images to local or should i fetch them on run time only?
This question for you , you should decide what you need or what is will be more suitable for your app . at any way if you want to cache images i suggest to use this library SDWebImage

iOS - how to handle online/offline data

I am currently developing an app with a big database. Think of the app as similar to TripAdvisor in the following way: multiple cities with different databases, each between 5, 10, 20, 30 MBs. My whole app is based on this data: every view needs some part of it.
I'm having big trouble finding the correct way to handle this huge chunk of data. I am currently using CoreData: I think it is a great tool, and for offline mode, it definitely works great.
The problem is, I can't really combine it with "online" mode. If the user doesn't want to store the data for X/Y reason, I'm not sure how I should handle the data.
Simply allocate it in variables that will be released anyway, or is there a better way to handle the data?
Right now I am stocking it into CoreData without saving it: I know this is absolutely not a good way to manage it. How could I achieve this?
What is the best way to handle online data and then simply stock it if the user wants it offline too?
Option 1:
Data is always static/ not change data frequently:
You should have data on online. You can fetch data by webservice and store it to local database(i.e core -data). For example: Bible, Quran app.
Option 2:
Data change frequently and user need to update frequently:same as above. Additionally, from server you send notification(i,e push-notification) to app that server has a new data.After getting notification in app, download and save data to you database.

IOS: Best Way to Cache/Store Strings Persistently

My IOS App periodically collects data that is time and location stamped (from GPS). That data is sent to a server if the app is online at the time the data is collected. BUT, if a data connection is not available I want the data cached to the iPhone/iPad until a data connection is obtained. When the connection is restored the data is uploaded and the cache is cleared. The data is in the form of an array of strings of SQL. Typically the array might contain a dozen or few dozen strings--nothing too large. The data should be persistent until it is cleared even if the app or device is shut down. Suggestions?
Have you thought about using NSUserDefaults for small amounts of data it is a value, key map solution and very simple. For large amounts of data something like JSON is good. Simply make the JSON when the data is created and then when connection in the app is detected parse the JSON and send it to the server.
I think the best way is to work with CoreData or you store the values in a local file.

How many records i can store in coredata

First time I make a network hit to (sql)sever to get the table data having 14 fields with image blob mostly. It has above 2 hundred thousand of records in table.
Can we store the 2 hundred thousand records in local database of device using core data.
Best way to place images in local file / DB. (or) we can using remote images loading.
Should work offline
Please suggest the best way of possible to fill this above requirement.
Storing 200k records in core data is not a problem in itself as long as you do the initial importing of those records correctly. Make sure you implement you update-or-insert properly otherwise your users will have to wait proportional to N^2. Apple suggests a nice implementation for this: https://developer.apple.com/library/mac/documentation/cocoa/conceptual/coredata/articles/cdimporting.html
Then once you have the local data, you probably need to fine tune the batch size of your fetch requests, but that's a good idea to do, even if you don't have 200k records.
As for the images, never ever store them in Core Data as binary blobs. Always store them as normal files on disk and store their path in Core Data to access them later on.

How is data loaded from a remote database stored locally (in memory)

What is the best way that data loaded from a remote database can be stored locally on iOS. (You don't need to provide any code, I just want want to know the best way conceptually.)
For instance, take Twitter for iOS as an example. When it loads the tweets, does it just pull the tweet data from the remote database and store them in a local database on the iPhone? Or would it be better if the data is just stored locally as an array of objects or something similar?
See, I'm figuring that to be able to use/display the data from the remote database (for instance, in a dynamic table view), the data would have to be stored as objects anyway so maybe they should just be stored as objects in an array. However, when researching this, I did see a lot of articles about local databases, so I was thinking maybe its more efficient to load the remote data as a table and store it in a local database and use data directly from the local table to display the data or something similar.
Which one would require more overhead: storing the data as an array of Tweet objects or as a local database of tweets?
What do you think would be the best way of storing remote data locally (in memory) (for an app that loads data similar to how Twitter for iOS)?
I suppose this begs this prerequisite question: when data from a remote database is downloaded, is it usually loaded as a database table (result set) and therefore stored as one?
Thanks!
While it's very easy the put the fetched data right into your array and use it from there, it is likely that you would be benefitted by using a local database for two main reasons: scalability and persistance.
If you are hoping to download and display a large amount of data, it may be unsafe to try to store it in memory all at once. It would be more scalable to download whatever data you need, store it in a local database, and then fetch only the relevant objects you need to display.
If you download the data and only store it in an array, that data will have to be re-fetched from the remote database and re-parsed on next load of your app/view controller/etc before anything can be displayed. Instead, create a local database in which to store the downloaded data, allowing it to be readily available to display on next load while new data is fetched from your remote source.
While there is some initial overhead incurred in creating your database, the scalability and persistance that provides you is more than enough to warrant that. Storing the state of a remote database in a local database is an extremely common practice.
However, if you do not mind the user having to wait for this data to be fetched on every load, or the amount of data being fetched is relatively low or the data is incredibly simple, you will save time and effort on skipping the local database.

Resources