Hi and welcome! This is build your first Native iOS app with a BaaS!
I ’ m Matt Dobson. I ’ m an engineer at Apigee. I love building apps, and creating tools that developers enjoy using.
Everyone have XCode installed? Simulators installed? Do you have your developer account up to date if you want to run it on a device?
I work at Apigee. I help create tools for developers to build apps, and manage data through APIs
We power the APIs of a bunch of large enterprises. These companies use internal and external developers to create awesome products.
We ’ ve been doing trainings similar to this for HTML5 and PhoneGap in the past, but now we are branching into the native development. This is our very first training ever for building on iOS.
We do this for free, because we want to show the developer community what the cutting edge of APIs and data management can do for their development process. We can do this for free because we make our money working with large enterprises to help manage their APIs and APPs.
Apigee is always free for developers. 25GB limit on storage for our hosted service. Our BaaS product is also open source so you can download, and quickly get running on your own cluster.
Here is today ’ s agenda. We ’ ll break in with an Objective-C and iOS primer. Where we ’ ll talk about Objective-C, and put together the UI of our app. Then we ’ ll add data storage capabilities using Apigee App Services. Lastly, we ’ ll look at what it would take to submit our app to the app store.
Have you developed on iOS before? Have you ever ran into stopping blocks? Is there something in particular that you had a hard time doing? Is there something you ’ d really want to learn in this class?
Time to break out some Objective-C!
What is Objective-C? It ’ s the primary language used to write iOS apps. There are other options and frameworks for writing iOS apps, but Objective-C is still the standard many app developers use on the Apple platform.
It ’ s object oriented. Everything in Objective-C is represented as an object. Objects interact with each other by passing messages back and forth. It ’ s way of thinking is very similar to Java, C#, C, C++, Python, Ruby, et al.
Code for apps are primarily contained in .h and .m files. .h files are header files that define what methods the class has, and the .m files contain the implementation of these methods.
Today you ’ ll run into objects that will have an NS prefix. This stands for NextStep the original creators of the language. The ongoing standard in Objective-C is to prefix your objects with either your initials or some other multi letter prefix so you have an idea of the object ’ s origin.
Reading Objective-C for the first time can be intimidating. You ’ ll see square brackets every where through the code. This is how methods are called. <Open up finished code sample, show off example of method call. Talk it through.>
Now lets download our project off of github. We ’ ve done a little bit of work for you, and will walk you through getting your app setup from start to finish. It ’ s a modified standard master-detail application. The app should compile, and run in the simulator but will crash if you begin to click around.
Download the sample at this jump link.
Today we ’ re going to build a simple list app that will keep track of all the books that we like. <Go through completed sample. Demo adding, deleting, viewing details of books, and other stuff. Maybe last minute add editing?>
First let ’ s get into Interface Builder and setup our app accordingly. Interface builder is the drag and drop tool that allows app developers to quickly setup user interface objects.
You ’ ll see a few of these terms thrown around in the code of an iOS app. Apps follow the MVC pattern where there are a separation of concerns between code that holds data, code that presents data, and code that communicates between presentation and data.
StoryBoards are the current standard for building interfaces in our app. It allows you to simple drag and drop UI elements into your app for use. It contains the full user interface definition of your application all in one place.<Take them through setting some stuff up.>
Before storyboards app developers had to worry about the presentation of their views between view controllers. We had to code all of our own transitions in our app. StoryBoards give us segues that easily allow us to easily define navigation through the application.<Go through setting up segues if possible in app.>
Our app is missing a segue. We want users to click the plus button and open a form modally in our app that will allow us to create a book.
Lastly we need to tell the story board what controllers handle what views. This is important when defining what data is presented by the UI, and what data is defined using the storyboard. While we ’ ve defined what controllers handle which views lets just take a look so you can see what is going on.
Apps are more fun with data! Lets look at integrating a BaaS into our app.
Apps today can ’ t do all the work on the device. Modern smart phones have constraints on memory, cpu usage, and network usage. A BaaS provides a simple way to use an API to integrate remote data storage efficiently into your app.
It ’ s essentially remote data storage you can access directly in your code.
Think of it as an iCloud or Dropbox that syncs your apps data across devices instead of documents or songs.
By using a lightweight library you can use API calls to Create, Read, Update, and Delete data with ease. The backend manages access and security through it ’ s API, and the server infrastructure make ’ s sure your data is backed up and safe.
In the code you ’ ll see references to UserGrid. UserGrid is an open source project acquired by Apigee a little over a year ago.
Before we can add BaaS to our app we need to sign up. Go to the link and sign up. After you ’ ve confirmed your account let ’ s go and play with the dashboard.
Add some data. Explain JSON and do a walkthrough of adding a book. Also explain the sandbox app is for learning and testing, but not production use.
We have tons of SDKs available to build apps on. They are all open source and we welcome contributions!
Okay now lets get some of the data we added in objective-c. Open app and add data retrieval code.
This is a two part answer 1. First we need to get all books on viewDidLoad execution. Then we need to display the @ ” title ” property of our book accordingly.
Now we can read data. Let ’ s have our device add data instead of using the dashboard. Walk users through writing create entity code.
We don ’ t want to keep books in our lists all the time. Let ’ s make sure we can delete books. Take users through removal code.
Now that we have a basic app completed. Let ’ s take a look at what it would take to submit it to the app store. I ’ d recommend you don ’ t submit this app. It ’ s a bit too basic for use in the app store just yet. You ’ ll also need an Apple developer account to interact with the app store.
Submitting an app is the most intimidating part. You have to walk through the creation wizards, and wait for Apple ’ s approval process to be completed.
First you need to create an app id. This holds app specific information like what apple services you want to take advantage of, and you ’ re globally unique bundle id.
Next you ’ ll want to generate a code signing certificate. This tells apple you are a registered developer with a specific app ready for submission to the app store. There is a similar process required for testing the app on the device.
Next you ’ ll need to create a production provisioning profile. This profile is used in conjunction with the certificate you created to install apps onto the device.
Next we ’ ll need to create the app in iTunes connect. This is where we upload icons, screenshots, app descriptions, and name our app. We ’ ll also go here to release it to the app store, and view how many downloads we ’ ve gotten.
Next is the waiting game. Apple takes between 2 weeks to a month to fully review an app and approve it for release into the app store. After every step of the review process you ’ ll receive an email that says it ’ s either passed or failed.
Once it ’ s ready and approved. Apple will email you with your approval, and you ’ ll have to enter iTunes connect to release your app to the store. It typically can take up to 48 hours to fully appear in the app store.
Congrats! You ’ ve just built a data driven app, and learned the app store submission process!
That ’ s a great first step, but what could we do next?
We can look at apple provided services, or apigee provided services to quickly build great data driven apps that users love. You can reach out to them with push notifications, give them contextually aware information using geolocation, have them setup profiles with user management, keep their data secure, work with files and pictures, or even build your own social graph! Apigee enables you to do all of this!
You could build your own
iCloud Store App or Social Network
You can easily scale to millions of users
Want more training? Reach out to [email_address] to get something online or in person organized for your user group, company, or other organization!
Join app craft to ask questions, share your app ideas, or help others in the process of designing and building their app!
Thanks! This is our first time doing the class so if you have feedback we ’ d love to hear it!
Build your first
Native iOS app with
an API Backend!