Problem with connecting multiple MFI controllers

Discussion in 'Public Game Developers Forum' started by Bill_H, Jun 11, 2015.

  1. Bill_H

    Bill_H New Member

    Jun 11, 2015
    1
    0
    0
    Hi!

    I'm currently working on a game in which I'm trying to allow multiplayer, with multiple MFI controllers. I am testing on an iPhone 6, running iOS 8.3, and 2 Madcatz C.T.R.L. controllers. I have been able to verify, using the app "Game Controller Tester" by Chibata Creations, that both controllers are indeed connected to the device. However, when I call "[GCControllers controllers]" in my app, the array returned has only one GCController object (determined both using a breakpoint and an NSLog). I have posted the relevant code (in Objective C) below, and hope someone may have encountered and solved a similar error, or be able to give me some pointers.

    In AppDelegate.m
    Code:
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // Override point for customization after application launch.
        
        if ([GCController class])
        {
            NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
            
            [center addObserver:self.window.rootViewController selector:@selector(setUpControllers:) name:GCControllerDidConnectNotification object:nil];
            
            [center addObserver:self.window.rootViewController selector:@selector(setUpControllers:) name:GCControllerDidDisconnectNotification object:nil];
            
            [GCController startWirelessControllerDiscoveryWithCompletionHandler:nil];
        }
        
        return YES;
    }
    In a view controller:
    Code:
    -(void)setUpControllers:(NSNotification*)notification
    {
        NSArray* potentialControllers = [GCController controllers];//this is the array that has only 1 element, but should have 2
    
        self.controllers = [[NSMutableArray alloc] init];
        
        if ([potentialControllers count] >= 1)
        {
    ...
        }
    }
    Thanks very much for your time!
     

Share This Page