Introduction
In this article I will create a Single View application. Here we implement Bluetooth in iPhone. For that we use "GameKit Framework" that is required to implement Bluetooth. It is a free app for chatting purposes.
To understand it we use the following.
Step 1
Open XCode by double-clicking on it.
Step 2
Create a New XCode Project by clicking on it.
Step 3
Now Select Single View Application and click on Next.
Step 4
Now provide your Product Name and Company Identifier.
Step 5
Select the location where you want to save your project and click on Create.
Step 6
First we import the framework "GameKit" that is required. 
Step 7
Now here we write the code.
AppDelegate.h
#import <UIKit/UIKit.h>
@class ViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) ViewController *viewController;
@end
AppDelegate.m
#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate
- (void)dealloc
{
[_window release];
[_viewController release];
[super dealloc];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
@end
ViewController.h
#import <UIKit/UIKit.h>
#import <GameKit/GameKit.h>
@interface ViewController : UIViewController<GKSessionDelegate, GKPeerPickerControllerDelegate>
@property (strong, nonatomic) UILabel *messageReceivedLabel;
@property (strong, nonatomic) UITextField *messageToSendTextField;
@property (strong, nonatomic) GKSession *session;
@property (strong, nonatomic) UIButton *sendButton;
@end
ViewController.m
#import "ViewController.h"
@interface ViewController ()
- (void)sendMessage:(id)sender;
- (void)connectToDevice:(id)sender;
@end




Dung TranPosted May 13, 2014, 2:50 AM
When i running this app on IOS 6.x or lower, it is very good but it don't work for IOS 7.x. can you help me?