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.
Related
I'm building a simple iOS app that will be the first I'll have put on Apple's App Store. At one point, the app accesses the user's contact list and lets them select any number of contacts they want to save as favorites.
For ease of building version one, I am currently using UserDefaults to save these favorites. While it has worked well in my limited testing, I know that Core Data and CloudKit are stable options for larger solutions.
For an app like mine, where I'm only using UserDefaults to save a select number of contacts as favorites, is UserDefaults an adequate solution? Or should I transition to something more robust like Core Data or CloudKit? There is no limit on the number of contacts a user could select as a favorite, so there is the edge-case possibility of a user selecting all of their contacts one by one and attempting to save them all as favorites.
If the user gets a new phone and loses all existing data due to UserDefaults being local on the device, it would not take long to get this app back to where they previously had it.
You can use CoreData to store favorite contact locally for large data as per your concern. Now when user switch device or delete app then all data will removed. So for that you can sync with cloudKit or other option is backend server. When user add any contact as favourite same time that contact will add to Core data as well as in backend server. You can sync this backend server data when user login first time in the app, then you no need to sync again. other all thing are as per requirement.
I use firebase in my ios app. For example, my database stores some data sets, which has being created by user. When user is authenticated, application starts downloading. But it is okay, when user has not bigger count of sets, because in this case, it is easy to download all data sets. On the other hand, if user has many-many data sets - it is terrible, because my app will download ALL this data immediately. How to use "page loading" with Firebase? For example - if user scroll to bottom, application starts downloading new piece of data from firebase database.
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 have one logical question.
I have one iOS app. which uses php mysql as backend. I am getting other user's feeds/Posts on the app home page. I am first getting latest post and saves it locally then display User Post and his details from local.
Now if some user has created one feed, that I will get and display at app side. after sometime if user changes his profile details(like changes his picture). So until that Post/feed updated I could not get know that the user has changed his picture. and every time user's old picture and details will be shown.
So can anyone suggest me which was the better way to update user's information? same like facebook does
Thanks.
Logical Answer:
Make an api in the backend which will return only the updated post.
From app side add a timer for around 3sec/5sec and call the api again and again, and refresh the feed with the current changes. If there is no changes you don't have to refresh the feed.
Make sure from the api you will return only changes not the whole feed again and again it will consume more data if you do so.