I have an existing web app that I have written in CodeIgniter using a MySQL database.
I now want to learn how to develop an iPhone app for the web app.
I have had a look at a lot of tutorials about xcode and iphone development but I have yet to see one about connecting and displaying data from my database.
I have seen the topic of RESTful come up a few times but am unsure if this is the direction I need to go?
If anyone has had success in building an iphone app that connects to a MySQL DB, would they be kind enough to share some tips or tuts on getting started.
I was working in a similar project: http://www.savemeeting.com It consists in an app (iOS, Android and Blackberry) and a Web showing the same information. Basically you need a Web Service (RESTful, XML-RPC, SOAP...) server and a Web Service client in your app.
I recomend you to write a RESTful server, if you use Code Igniter, you can use this library: https://github.com/philsturgeon/codeigniter-restserver and then write the client in your iOS app (sorry, I have no knowledge to guide you in this part).
Related
I'm currently building a new project that needs a web app and mobile app and i'm forced to work with Laravel and React Native.
So my question is if I can connect between the two app's using MySQL ?
PS: I already searched and i did find this topic here, but i didn't get the idea clear.
Laravel can be just a backend and React-Native is a front-end. Your React-Native can talk to a Laravel backend without any problem or can share a database such as MySQL, it is no different then using a Node, ASP.NET, Ruby or even a Perl backend for your React-Native app to serve a REST API and connect to a database.
Not knowing the details of your website, I would look to build a REST API that can be used by React, React-Native (iOS android, or both) and the laravel based website. Certain features like authentication should easily work cross platform, other API calls may need to be tailored to Mobile vs Web. The backend can be Laravel or any other system include Node as long as it is a REST API, both the site and app will be able to use it.
Total beginner question (apologize in advance for the stupidity :( )
I am trying to learn how to develop apps using ionic framework/angular.
I created a simple news feed (UI part of it anyway).
I then installed MySQL, PHP and Apache on my Mac (MAMP). I have created some tables and inserted some dummy data.
Now, I am completely lost on what kind of routine/procedure to write on my server, and what code to write in my Angular service so i can show the dummy data in my app?
Basically, how do these two discreet "things" on my system know how to connect and exchange data?
I googled it for few days, but most tutorials don't seem to address this basic question.
I don't actually expect somebody to take me through the steps, but if you can point me to some tutorials/resources on this, it would be much appreciated.
Thanks in advance.
You will have to think in terms of web/RESTful services to expose data to your Angular app. I can point you to a couple of introductory tutorials on the MEAN stack (MongoDB, Express, Angular, Node), but you'll get the idea:
Learn to Build Modern Web Apps with MEAN
Mastering MEAN: Introducing the MEAN stack
Several references to online resources, by ericdouglas
Since you are using AngularJS, your frontend app is a single-page app I suppose. All data your frontend app based on is provided by your backend, here is PHP/MySQL.
You need to use PHP to create a REST service to provide JSON data, which can be consumed by AngularJS app. While MySQL is behind your PHP app as a storage provider, it doesn't talk to your AngularJS app directly.
So I've built a web app in PHP that relies heavily on a MySQL database. Now (for user convenience purposes) I'm trying to create the exact same app, just as an iPhone app. Granted, I have no knowledge of Objective-C (just starting to learn it), I wanted to know how to go about this. I know that I'll have to use some kind of intermediary to get Objective-C to connect to the SQL database.
So essentially my questions are: If I've already created the web app as aforementioned, could I use the same DB and tables for the iOS app version as I did for the PHP web version? Also, is there anyway to migrate any code I've created in PHP to iOS (I realize that they are two completely different languages), but I'm just curious as to whether or not I'll have to build the iOS app from 'complete' scratch.
Your best bet is to write an PHP service to talk to your database.
This way you can share this API between your app or iOS app or any other type of client app.
The service will be responsible to receive request query the database and send responses in JSON format for example.
So to make things easier, you should not query the database directly from your apps, use a common web service.
You can use your MySQL database for any purpose because it is just data. The code that will show them will be different though. If you have no knowledge about Objective-C you should consider the web-app approach.
Here are a few helper links.
https://developer.apple.com/library/safari/referencelibrary/gettingstarted/gs_iphonewebapp/_index.html
http://gigaom.com/2010/02/12/how-to-create-an-iphone-web-app/
If got a task to create a mobile application for iOS, Android and WP. This application needs to access a mySQL database which is already in use by the website running php.
What I found in the meantime, is that I have to create a php webservice and use this webservice to access the data in the mySQL database.
Since I did not found any clear advice which way is the best to do it (JSON, XML, REST, etc) - I just wanted to ask you, is there a kind of best practice which technologies should be used for the php webservice?
Additional it would be great for me if someone knows a good tutorial for the recommended technology.
Thanks a lot.
I am arriving a bit late but here is my answer : I believe that the easier way currently available is a PhoneGap application (with Sencha Touch or jQuery Mobile as a javascript framework) talking to the server through a simple PHP webservice. PhoneGap allows you to build an Android, iOS and WP app with the same codebase.
We use that technology in my company and it works great.
I am working on a social network project in PHP/MySQL. If you have ever seen or used the myspace or facebook iPhone app you will see what my question is all about. I am curious what most iphone apps do with the server for a social network type iphone app. I was tyhinking possibly it uses a REST server with jSON or XML output and possibly the iphone app will just read that? Or does most iphone apps do there own query to a database somehow? Sorry I really don't have any knowledge in that sort of programming so I could be way off on all this.
So basicly what would be the most efficient way for a iphone app to get data from a server?
In my opionion, the ASIHTTPRequest Library, a RESTful Webservice and the JSONTouch library are working great together.
To get you started (including a PHP/MySQL example) take a look at this great tutorial:
iPhone Coding Tutorial – Creating an Online Leaderboard For Your Games
A RESTful approach is almost certainly the cleanest and easiest. The iPhone API has great support for communicating via XML.
There are some fairly comprehensive examples in Apple's Developer Connection.
http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/XMLParsing/XMLParsing.html
You would use JSON or XML web services but you can use whatever HTTP mechanism you like.
Answering the second part of your question no the apps don't normally talk direct to the database but use web services instead.