I'm new on iOS development and I got a problem with storing the last time Tweets got updated from API in iOS?
I want to retrieve tweets after the last time I retrieved and what is the best practice for getting the time my app retrieving tweets? Store it somewhere or get the latest tweets from core data(I store tweets in core data)?
You can use the since and until operator.
https://api.twitter.com/1.1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=your_screen_name&since:2011-05-16&until:2011-08-16
Related
In an iOS Twitter like app that I am building with Firebase, I make an initial call to the backend to receive the newest 20 "Tweets" for a user's newsfeed in viewDidLoad().
In order to fetch older Tweets after the 20th newest Tweet, I would like to use UICollectionViewDataSourcePrefetching in iOS 10 to fetch these older "Tweets" as a user scrolls down.
Using UICollectionViewDataSourcePrefetching, I will be able to anticipate when a user will want to see older tweets and I can then make a call to the backend to fetch them.
If I were to make multiple calls to the database in quick succession to fetch different tweets, such as to get the 25th newest tweet and then get the 26th newest tweet, does Firebase guarantee that I will receive the calls back in the correct order?
E.g. the oldest call to the database always comes back first, followed by the second oldest etc. So that I can guarantee the order of the tweets displayed is correct by simply inserting them into my data model without having to worry about checking the timestamp for each tweet.
The Firebase Database client interacts with its server over a single open connection. So in general the items will be returned in the order in which you request them.
But due to the nature of asynchronous code, there are some interesting edge cases that (while they don't violate what I said above) may cause problems in your app.
Without seeing your code, it's hard to say anything more.
I am stuck to a point, I am managing my app offline also. first time i get all profile data from a webservices and store its path into sqlite, I am facing problem in updating those data, like if images are changed how should I notify into my app, I searched it on Google and only solution is to send push notification to app when record is updated. What if user do not allow push notification?
Is there any other solution to manage app offline and update only when record is changed from online database?
implement offline mode in application
put one extra column data_status in all table That indicate data is entered in local database is in offline or online mode. 1 for online and 0 for offline
call API every-time with last response date and time on some frequent time interval(if required to update data frequent otherwise call when need) and API respond only changed or new data
when application is online
call API and Store data in local data base with data_status = 1
and then display that data on screen from local database
now when call again same API with server API response time and date and API respond only changed or new data.
when application is offline
check app is offline then skip API calling function and fetch data from local database.
now, when action perform on data like update insert. make that row data_status = 0
when internet come check local data base which data is with data_status = 0 and call web service according that one by one, and getting success of each API make data_status = 1 and update row in local database.
Thank you
I would suggest to give Image Name base on timestamp and unique userId. like as below.
ImageName = yourUserId_timestamp.(111_1234567).
So Image name always be unique. so when you fetch date from server. first check that image is already exist in data base or not. if it is not then update image name with help of userId and store it. if it is then leave it.
Thanks
Nothing to change from your (application) side, your server guy can handle this flow. Whenever a new image will be upload, a new URL will be generated that you will for particular object. You can replace it in your local (simply update existing data).
You can use API's to check version of data cached in App. If updated version is available on server then you have to update local data with updated server data.
I want to store only 20 Notifications which include
"Title,Detail and Received Time" fields inside Notifications Table.But,I only found solution for working CoreData with CRUD some example.But,I am still seeking for working with limitation when user fetch new results from api inside device database.That is where I am stuck.I don't know how to do it using CoreData because I was beginner at that.
Requirement :
1.Application can only store 20 Records maximum.So,when it reach max length,it will do First-In-Last-Out to Notifications table base on Notifications Received Time.(First Problem)
2.Every time the user do pull to refresh,my app fetch new notification from Web-Backend and replace or overwrite on user device database when it successfully download new notifications like "Push Notification Service App" on App Store.(Second Problem)
I really need a hand to pick up with core data flow which I am stucking at things I am not familiar with.
Any help or guide please?(Posting Sample with .json is appreciated)
use NSUserDefaults for that if your data size is small
Consider using a service, like RestKit or similar, to support your web service interaction. Each record should have a unique identifier supplied by the server so you can find an existing copy and update it instead of needing to delete everything and recreated it.
To trim your data use a fetch request with a fetchOffset and a sortDescriptors by date. This allows you to skip the newest 20 items and gives you a list of everything that needs to be deleted. If you're using RestKit you can supply this fetch request in a fetch request block and the deletion will be done for you.
I'm trying to design an app for my club at school. What I want to happen is when there is new information about meetings or events I want to be able to add this new content to the app and then have it visible by other app users.
So my question is how would I approach this idea?
Conceptually, you're going to need to have a centralized server which contains the data, an API to connect an application to this data, and finally the end user application.
On the server end, you could have a simple database which will house the event and meeting information.
On the API end, you could have a simple script which fetches the latest entries in the database and displays the data in a standard format such as JSON or XML.
On the app end, every time the user opens the application, fetch the latest data from your API and parse it into an array. Then, just populate a table or collection with the data in that array. You could also add a pull to refresh control to fetch the latest information at any time so the user doesn't have to launch the app again.
I am developing iPhone application which contains the facebook connect as part of it. I am using third party API FBGraph to retrieve the Facebook friends list.
Currently my problem is that, when there is huge number of friends in list, it takes much time to load those. Its loading again and again when I navigating through the pages and come again.
In order to avoid this, i am trying to use caching concept. But I am currently stuck with this. I dont have clue on how the Facebook friends list can be cached.
There are numerous ways to cache the data in IOS.
You can store the response in a file and use that file whenever you require.
You can store it sqlite db using core data / standalone
and many more.
Just load user friends at app start and then use it all the time.