Getting started with Xcode 4.x and Bluetooth Smart (BLE) on iOS

Getting started with Xcode 4.x and Bluetooth Smart on iOS

I’ve made this step by step guide on setting up your first Bluetooth Smart  iOS project, it starts from scratch.

  1. Get xcode via Mac OS X Appstore or from http://developer.apple.com .
  2. You will need an Apple developer license to load any application to an iOS device, also for just testing.
  3. Since as of now, there are no Bluetooth Smart support in the emulator, you will need an iPhone or perhaps iPad3 ? :) to test your application.
  4. I think I will make a guide on how to install certificates and such later, also howto for making an ad-hoc package.

After these steps are done you can proceed in making a new project :

1. Create a new project from the main menu :

Creating a new project in xCode

Creating a new project in xCode

2. Step one will bring up the Project Template dialog :

Dialog for choosing a template for your new application

Template choosing dialog

The template choosing dialog selects what type of template Xcode should use to autogenerate some UI code for you. For your first project you should choose the single view application as it gives you a start window, and nothing more, then press next.

3. Dialog for setting project options.

Selecting project options

Dialog or selecting project options

  •  Product name              - The name of the program you are going to write.
  • Company identifier    - The name of the company your writing for.
  • Bundle identifier         – Name of the project together with company, this is autogenerated.
  • Class Prefix                    - All classes made(by xCode) in the project will get text added in front of them.
  • Device Family                - I would say that if possible use the universal (for both iPhone and iPad) if possible, iPad 3 is right around the corner, and it will probably have BLE, so try to write your applications universal.
  • Use storyboard             – Storyboard is the function in xCode where you can “draw” the user interface, enable or disable the use of it.
  • Use Automatic Reference Counting – Selects automatic garbage collection on or off (in the off state you will have to allocate and discard all your objects yourself).
  • Include Unit Tests       – Selects if project should have unit testing code (code for testing your code :) )

4. Dialog for project save destination.

Dialog for selecting save location

Dialog for selecting save location

Here you can select the destination to save to, and also if a GIT repository should be made for source control of your code. I use SVN mostly so I turn it off.

5.Your shiny new projects main screen

Here you see the project main screen

Project main screen

This is the main screen, here you can change almost every option of your project, now we should add the CoreBluetooth library to link with.

6.Adding library dependencies

Build Phases tab

Build Phases tab

Select the “Build Phases” tab, and then press the “+” sign to add more dependencies (more libraries to link).

7. Select CoreBluetooth.framework and press add

Adding a framework to your project dependencies

Adding a framework to your project dependencies

8.Your project is now ready for coding :

Project ready for coding

Project ready for coding

Now you are ready to start using the CoreBluetooth library in your project.

 

5 Responses to Getting started with Xcode 4.x and Bluetooth Smart (BLE) on iOS

  1. Pingback: Added my first quick howto ! | Bluetooth Smart Log (BLE)

  2. James K. says:

    that’s cool! I,ve just start using Xcode and have been working with BLE bluetooth.
    Kind of struggle and cannot wait to get started with your tutorial. Thanks

  3. Ploy says:

    Can’t wait for your tutorial!

  4. Max Harvin says:

    any in depth tutorial?
    Thanks

  5. Hi. I am looking for the sample project for the SensorTag app v4.1 to work with the CC2640. Any idea how to get ahold of it? Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">