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.
- Get xcode via Mac OS X Appstore or from http://developer.apple.com .
- You will need an Apple developer license to load any application to an iOS device, also for just testing.
- 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.
- 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 :
2. Step one will bring up the Project Template 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.
- 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.
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
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
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
8.Your project is now ready for coding :
Now you are ready to start using the CoreBluetooth library in your project.