Linking online databases to a project for iOS - ios

I'm working on an iOS app for having a list of top 10 of everything.
So the problem I'm facing is how do I update the list every week ?
I thought of linking it to external links but then I was unable to format the webpage according to the interface of my app.
Lastly I want the app not only to display the top 10 list but also to be able to interact. For example if the user enters into top 10 songs then he should be able to play the tracks as well ! So for this I guess I'll be needing a database which I could update weekly. I don't know how to go about this. Please help !

You need a remote server, running with an application that handles the list generation/updates, and you will probably need also to manage a remote database, if you expect that the number of item will be reasonably large.
Your ios application will have to interact with your remote server using an API that you will have to define as well.
I'm sorry to be that generic, but the hard truth is that there is no quick or easy way to do it: you will need to learn and possibly develop every part of your system and then integrate them.
You have nearly an infinite number of options in terms of platforms/languages/databases to choose from, for the backend part.
Over the last few years, there have been services that should make handling the remote backend easier (Stackmob, cloudbase...) but it really depends on much control you want to have on the "lists" you want to manage.

Related

Two player chess game using Firebase

Edit: The answer is to use firebase realtime database.
I wrote a library for the next person.
https://github.com/flipflopapp/turnbased-games-with-firebase
-- Question --
I am implementing two player chess game (www.halfchess.com) and am considering using firebase messaging (instead of using sockets to create rooms and two player matches). The game would involve sending 60-100 chess moves as messages between two devices in two to three minutes (that can be android or iOS). My nodejs server would have code that enables device to device messaging (receiving from one player and sending to other).
I cannot use Google Game Services because I don't have google login implemented in my app (I only plan to keep facebook login). The advantages of using firebase (compared to sockets) is that I will have to write much lesser code (reconnections, etc) and it would take care of scalability issues.
My questions are :-
(1) Will there be problems when the users playing against each other are on two iOS devices (instead of android's)? (such as higher latency)
(2) If a user is changing location physically and a message that contains a chess move is undelivered, when will it be retried?
(3) For a fast game of chess, will the latency be manageable? This is like 8-10 times the speed of normal chatting.
While I read more on the topic, perhaps someone who has already experimented can comment.
Firebase Cloud Messaging is not meant for kind of usage, and in addition to a non guaranteed delivery time (some researches from 2013 - 2014 shows more than 1 seconds per message on avarage), FCM will probably imply throttling in such a use case.
See also this SO post
I'm sure the answers above will work but, I was having a tough time getting them to function. This is what eventually worked for me and my firebase chat app!
Hopefully, this will help some folks out there.
I was able to add a chess game to my firebase chat app and, all I used was an iframe! However, it didn't work the first time because, all I did was add the iframe coding to my app.
This is how I got my iframe to work in a firebase app...
First, change directory (cd) into your chat app's "public" folder (where you would typically run the "firebase deploy" command) and, add your iframe to the "index.html" document located there. Use this address for your iframe's source URL (src)...
src="chess/index.html"
It wont work right if you do not include the "index.html" page name!
Next, I created a new folder named "chess" in the same public directory and I added the chess game's "index.html" doc and dependanciess to it (js,css,images...etc).
And last, but not lease, open a terminal in the same "public" folder and run "firebase deploy" to upload the whole thing to your firebase account and console.
Done!
I'm pretty sure that including your chess app docs inside of your firebase app is what made the iframe finally work. I also wrapped the iframe with a couple of 'div' tags but, I'm not sure if that made any difference.
Please, feel free to come and take a look but, you'll have to sign in with Google to gain entry!
After that, just right-click anywhere on the page and select "view source" to see the code. Cheers!
https://friendly-chat-b2d6a.firebaseapp.com/
Instead of having the other player send a message to the client, why not just have the client display a message based on whats happening in the game? It seems like an easier solution for you, as the only thing that needs to be sent is the actual move, and you can piggyback off of that if you need to.
I realized I should be looking at Firebase Realtime database (and not messaging).
Useful links:
https://firebase.googleblog.com/2016/07/have-you-met-realtime-database.html
Is firebase realtime json database suitable for data broadcasting?
https://firebase.google.com/pricing/
https://groups.google.com/forum/#!topic/firebase-talk/n_B1nrgp580
(according to this talk the latencies can be < 200ms most of the times)
https://twitter.com/jonikorpi/status/733560092780462080

Can you turn only one page into an app in meteor?

I have just tried to run
meteor run ios
That command emulates my application as an app. But there is just one page that would be interesting to have as an app. Can you control this in some way?
I don't think this is possible. The whole app gets exported regardless of platform, hence the universal/isomorphic apps concept. And in the universal app concept is one that I'm starting to find fault in. That said there is a better middle ground.
We'll call it sudo-universal apps. (probably a horrible name, but whatever :D)
Essentially the concept is that you have 3 codebases, for each device (web/ios/andriod) but share many of the same modules via something like npm, or potentially some other way of sharing code.
Then you can focus on the ui for each device and its strengths and weaknesses, but keep all the important logic you've built.
Check out the following:
https://voice.kadira.io/say-no-to-isomorphic-apps-b7b7c419c634#.3bn5ovts1
https://forums.meteor.com/t/say-no-to-universal-apps/16813/7
Hope this helps!
You can check whether the client code is executed on iOS or not, and change the app accordingly:
if(navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) {
// Disable the links, and redirect to which page you want
}
But Justin's answer is great, a new platform usually needs more than just some tweaks. A quickly developed app has very low value for the user.

Iphone app that needs to scrape a website once every day

So I'm making an iphone application that needs to scrape a website once everyday.
What I'm going to scrape is a table of upcoming games for that same day for a soccer division. Thats why i need the app to scrape from the same page and same table once everyday to keep the upcoming games updated.
I was referred to import.io but they didn't have something like a schedule re-crawl.
I would love to get some ideas and tips to how i should do this since I'm stuck now.
You might take a look at https://www.kimonolabs.com/
I played around with the service a while back and was impressed with how easy it way to set up. They have a "free" option so long as the APIs you create are not private.
Oh, and I agree with Paul, screen scraping is not something the iOS client should be doing. Too fragile, and when (not if) something breaks, you will need to go through an Apple review process to fix it.
This doesn't seem like something an app should do, your server should do it (so that the scraping is only performed once), and your clients can retrieve it from your server. That also means you could send out push notifications for important fixtures etc. Maybe that's what you meant, anyway.
If it's on the server you can just setup a scheduler (in Java, for example) to run once every x hours (probably a smaller number than 24 assuming you don't know when the website is to be updated). Then your app can just get the latest list of fixtures from your server on startup, pull-to-refresh, etc. Presumably someone will open your app, look at the fixtures, then come out of your app - so it doesn't seem like you need to cover the case where someone is in your app all day, but if you did you could use NSTimer to run every x minutes after the initial on-startup server call.

iOS App Offline and synchronization

I am trying to build an offline synchronization capability into my iOS App and would like to get some feedback/advice from the community on the strategy and best practice to be followed to do the same. The app details are as follows:
The app shows a digital catalog to users and allows them to perform actions like creating and placing orders, among others.
Currently the app only works when online, and we have APIs for all actions like viewing the catalog, creating/placing orders which return JSON data.
We would like to provide offline/synchronization capability to users, through which users can view the catalog and create/place orders while offline, and when they come online the order details will be synchronized and updated to our server.
We would also like to pull the latest data from the server, and have the app keep itself up to date in case of catalog changes or order changes that happened at the Server while the app was offline.
Can you guys help me to come with the best design and approach for handling this kind of functionality?
I have done something similar just in the beginning of this year. After I read about NSOperationQueue and NSOperation I did a straight forward approach:
Whenever an object is changed/added/... in my local database, I add a new "sync"-operation to the queue and I do not care about, if the app is online or offline (I added a reachability observer which either suspended the queue or takes it back working; of course, I do re-queueing if an error occurs (lost network during sync)). The operation itself reads/writes the database and does the networking stuff. My ViewController use a NSFetchedResultsController (with delegate=self) to get callbacks on changes. In some cases I needed some extra local data (it is about counting objects), where I have used NSManagedObjectContextObjectsDidChangeNotification.
Furthermore, I have used Multi-Context CoreData which sounded quite reasonable to use (I have only two contexts).
To get notified about changes from your server, I believe that iOS 7 has something new for you.
On the server side, you should read a little for the actual approach you want to go for: i.e. Data Synchronization by Dan Grover or Developing Android REST Client Applications (of course there are many more good articles out there).
Caution: you might be disappointed when you expect an easy solution. Your requirement is not unusual, but the solution might become more complex than you expect - depending on the "business rules" and other reasonable requirements. If you intelligently restrict your requirements you may find a solution which you can implement yourself, otherwise you may also consider to use a commercial product.
I could imagine, that if you design the business logic such that it takes an offline state into account and exposes this explicitly in the business logic, you may find a solution which you can implement yourself with moderate effort. What I mean by this is for example, when a user creates an order, it is initially in "not committed" stated. The order will only be committed when there is access to the server and if the server gives the "OK" that this order can actually be placed by this user. The server may also deny the order, sending corresponding messages to the user.
There are probably quite a few subtle issues that may arise due to the requirement of eventual consistency.
See also this question which contains pointers to solutions from commercial products, and if you visit their web sites give valuable information about the complexity of the problem and how this can be solved.

BlackBerry - call time tracking application

hallo,
I have a common question, I hope it is ok to ask it here.
I have a project, where I should develop a small appliation for BlackBerry. I know Java ME is the platform to do that (Browser and Widget are other opstion).
What I need to do is a samll application which pops-up after every call and asks the user if he wants to save(assign) this conversation (only the duration in minutes of the phone call is important) in his time-tracking database. He can click NO, but after it, he can start my application and see all unassigned phone calls and still he can assign them in the time-tracking db. This should happen offline and than be synchronized with the server via online connection.
My question now:
What APIs are to be used, for handling with the phone-calls?
Are there some downsides in this kind of application, which I newby can not see at first?
What about the different devices?
Thanks for any information you share with me, to help me avoid common newby mistakes!
Thnaks a lot.
That should definitely be doable, look at the PhoneListener interface to check when the phone call disconnects. What I would do is write the application as a system module, that will run in the background on startup. You can use an alternate entry point so that when the user clicks on your icon the application will create a GUI.
Edit: By the way BlackBerry uses an extended version of J2ME. You can ignore all the RIM specific extensions if you want and develop an app that will (theoretically) work on any J2ME device but you won't be able to use a lot of nice features including the PhoneListener interface. I doubt you'll be able to create this specific application with J2ME alone.

Resources