Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

developing iPhone apps to connect to DB

Featured Replies

I've decided to try and teach myself the basics of iPhone app development as I want to try and make a small app for my website, I was wondering if the way I think it works is correct and if anyone could give me any pointers.

 

I have my website and my database.

 

I create a php page on my site that takes values from the url and with those values queries the database, returning a JSON object.

 

In the iPhone app I make a script that sends a http request that returns the JSON.

 

I think that's right...

 

 

If you want to write to the database from the iPhone app, do you need a completely separate PHP page where you write to the DB instead of reading, or should it be done in the same page?

That's pretty much it in a nutshell.

 

I recently developerd a CMS to manage data for an app and generate JSON data files which the app pulled in as required.

  • Author

That's pretty much it in a nutshell.

 

I recently developerd a CMS to manage data for an app and generate JSON data files which the app pulled in as required.

 

Ok cool, I think first thing I'm going to do is create the page on my site that returns the JSON. Then I can start to look at learning the objective-C and testing it :)

Edited by adamsmith

  • Author

If I want to add lots of info to the database is it just a case of adding each thing to the URL and having a really long URL or is there another way to add the data. Maybe via POST instead of GET. Is there any steps that need to be taken towards security at the iPhone stage that I need to be aware of?

If I want to add lots of info to the database is it just a case of adding each thing to the URL and having a really long URL or is there another way to add the data. Maybe via POST instead of GET. Is there any steps that need to be taken towards security at the iPhone stage that I need to be aware of?

I'm no IOS expert so you'd need to consult the IOS developer help docs/forums for best security approcahes.

 

For managing your content database it can be as easy or as hard as you want to make it. If you end up with trying to access long URLs (eg with long query strings) then it could get messy and obvioulsy prone to mistakes.

 

The last site I did used Expressionengine for managing data and pumping out JSON data, this allowed us to set up nicely formatted URL's with a common format so the app could dynamically grab sets of data as it neede:

 

Eg for date based information

 

/data/events - would pull out all "events"

/data/events/2012 - would pull out all "events" for 2012

/data/events/2012/02 - would pull out all "events" for Feb 2012

/data/events/2012/02/28 - would pull out all "events" for 28 Feb 2012

 

Then something like this for other data types

 

/data/articles - would pull out all "articles"

/data/articles/recent - would pull out "articles" limted to the most recent

/data/articles/date/2012 - would pull out all "articles" from 2012

/data/articles/date/2012/02 - would pull out all "articles" from Feb 2012

/data/articles/entry/41 - would pull out the "article" with ID41

/data/articles/category/fish - would pull out all "articles" in category "fish"

/data/articles/user/2 - would pull out all "articles" authored by member ID 2

  • Author

Ok thanks I'll look into that, I'm just trying to get my head around adding to the db rather than reading. I might need to add up to 20 pieces of info to the db at a time

Have a look at RESTful APIs. I created a basic one for use with an iPhone app. Not sure how it's done in objective-c but you do POST/GET requests depending on what you want to do.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.