★ TouchArcade needs your help. Click here to support us on Patreon.

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

08-08-2010, 02:47 PM
#1
Joined: Feb 2010
Location: London, England
Posts: 397
Probably not the place (sorry), but an OpenFeint techie question for the experienced

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!

Last edited by amroc; 08-08-2010 at 02:51 PM.
08-09-2010, 02:52 AM
#2
Joined: Oct 2008
Location: Toronto Canada
Posts: 863
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.

SHREDD GO FAST! FREE!
Nozoku Rush Kick Math's Ass!
Critter Panic Break yer brain! FREE!
Silverfish & Silverfish MAX Hardcore arcade insanity!
Nozoku A casual game of math & logic.
More: cbox.me Twitter YouTube
08-10-2010, 05:56 AM
#3
Joined: Feb 2010
Location: London, England
Posts: 397
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
08-10-2010, 02:33 PM
#4
Joined: Oct 2008
Location: Toronto Canada
Posts: 863
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.

SHREDD GO FAST! FREE!
Nozoku Rush Kick Math's Ass!
Critter Panic Break yer brain! FREE!
Silverfish & Silverfish MAX Hardcore arcade insanity!
Nozoku A casual game of math & logic.
More: cbox.me Twitter YouTube