Probably not the place (sorry), but an OpenFeint techie question for the experienced

Discussion in 'Public Game Developers Forum' started by amroc, Aug 8, 2010.

  1. amroc

    amroc Well-Known Member

    Feb 12, 2010
    407
    2
    18
    Male
    Games Programmer
    London, England
    #1 amroc, Aug 8, 2010
    Last edited: Aug 8, 2010
    Just having a problem with OpenFeint and UIViewControllers receiving orientation events:

    Ok so my game supports all four orientations. Currently, just coded within OpenGL, as opposed to using UIViews/Controllers (I just register to receive Orientation events from the UIDevice).

    But, I'm now wanting to add in a few UI Widgets (simple stuff, name entry TextView and keyboard for my local highscoreboard).

    I have tried adding my UIViewController as a subview to my main view, and it all reorients fine when OpenFeint is not initialized. However, when I do initialize OpenFeint, then later add my UIViewController, the UIViewController does not receive orientation events. I can confirm this as the following overidden method is never called:

    - (void)willRotateToInterfaceOrientation: (UIInterfaceOrientation)toInterfaceOrientation duration: (NSTimeInterval)duration

    As I mentioned before, if I don't initialize OpenFeint my added UIView reorients properly (the above method gets called fine). Additionally, if I initialize my UIViewController and add it *before* initializing OpenFeint, then it does receive events. However this isn't the preferred approach as the UIViewController should just be created when needed, instead of being alloc'd permanently and just sitting hidden in the subviews until needed.

    So, it looks to me as if OpenFeint, after being initialized (and so added to the subviews), somehow blocks these events for all views added later. Is this a bug or is there just a different approach I should be using to handling this? I have tried all combinations of adding views in different positions in the subviews array etc, and no luck.

    If you made it this far well done, and thanks! ;)
     
  2. ChaoticBox

    ChaoticBox Well-Known Member

    Oct 8, 2008
    878
    6
    18
    Male
    Developer
    Toronto Canada
    Saw your tweet about this, and tweeted back something to the effect that OpenFeint 2.5.1 was the problem but I was wrong. I see similar issues with any recent OpenFeint version...

    I managed a workaround by iterating through the main window's subviews in my OpenFeintDelegate's dashboardDidDisappear method and calling removeFromSuperview on anything that shouldn't be in there. Hacky, but so far OpenFeint doesn't seemed bothered by it.
     
  3. amroc

    amroc Well-Known Member

    Feb 12, 2010
    407
    2
    18
    Male
    Games Programmer
    London, England
    Hi Frank,

    Awesome, I hadn't tried downgrading to 2.5 yet (on a sort of holiday at the moment, so not finding much time). I had briefly looked into a way to remove OpenFeint's ViewController from the chain, it sounds like a fair enough workaround to me. I assume though that means you won't get notifications and stuff, ie you'll just get the dashboard?

    Thanks lots :)
     
  4. ChaoticBox

    ChaoticBox Well-Known Member

    Oct 8, 2008
    878
    6
    18
    Male
    Developer
    Toronto Canada
    Notifications seem to be working for me at this point, and don't appear to affect my own UKit stuff like the dashboard does. I just use the occasional modal view though, so I can't vouch for more complicated setups.
     

Share This Page