2011   2   21
2011   2   21
2011   2   21
2011   2   21
2011   2   21
GKPeerPickerController* picker = [[GKPeerPickerController alloc] init];

                picker.delegate = self;

                picker.connectionTypesMask = GKPeerPickerConnectionTypeNearby;

                [picker show];




                - (void)peerPickerController:didConnectPeer:toSession:




2011   2   21
session = [[GKSession alloc] initWithSessionID:SESSION_ID
       !   !    ! ! ! ! ! ! ! ! ! ! displayName:nil
       !   !    ! ! ! ! ! ! ! ! !             sessionMode:GKSessionModePeer];
       !   !    [session setDataReceiveHandler:self withContext:nil];
       !   !    session.delegate = self;
       ! !




                session.available = YES;



                - (void) session: didReceiveConnectionRequestFromPeer:



                - (void) session: peer: didChangeState:

2011   2   21
2011   2   21
2011   2   21
peersWithConnectionState:




2011   2   21
2011   2   21
2011   2   21
2011   2   21
- (void)applicationDidEnterBackground:(UIApplication *)application {
               [self.currentSession disconnectFromAllPeers];
               self.currentSession.available = NO;
       }

       - (void)applicationWillEnterForeground:(UIApplication *)application {
       ! !   self.currentSession.available = YES;
       }




2011   2   21
2011   2   21
2011   2   21

iPhoneのBluetoothについての知見まとめ

  • 1.
    2011 2 21
  • 2.
    2011 2 21
  • 3.
    2011 2 21
  • 4.
    2011 2 21
  • 5.
    2011 2 21
  • 6.
    GKPeerPickerController* picker =[[GKPeerPickerController alloc] init]; picker.delegate = self; picker.connectionTypesMask = GKPeerPickerConnectionTypeNearby; [picker show]; - (void)peerPickerController:didConnectPeer:toSession: 2011 2 21
  • 7.
    session = [[GKSessionalloc] initWithSessionID:SESSION_ID ! ! ! ! ! ! ! ! ! ! ! ! displayName:nil ! ! ! ! ! ! ! ! ! ! ! sessionMode:GKSessionModePeer]; ! ! [session setDataReceiveHandler:self withContext:nil]; ! ! session.delegate = self; ! ! session.available = YES; - (void) session: didReceiveConnectionRequestFromPeer: - (void) session: peer: didChangeState: 2011 2 21
  • 8.
    2011 2 21
  • 9.
    2011 2 21
  • 10.
  • 11.
    2011 2 21
  • 12.
    2011 2 21
  • 13.
    2011 2 21
  • 14.
    - (void)applicationDidEnterBackground:(UIApplication *)application{ [self.currentSession disconnectFromAllPeers]; self.currentSession.available = NO; } - (void)applicationWillEnterForeground:(UIApplication *)application { ! ! self.currentSession.available = YES; } 2011 2 21
  • 15.
    2011 2 21
  • 16.
    2011 2 21