OpenFeint is on only half of the screen - iphone

I'm trying to implement OpenFeint in my Cocos2D iPhone game, but here's something weird that I didn't find how to solve.
Here's how OpenFeint looks like when I initialize it:
http://img842.imageshack.us/img842/8564/screenshot20100926at520.png
And here's the code of the initialization:
[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft], OpenFeintSettingDashboardOrientation,
#"NAME", OpenFeintSettingShortDisplayName,
[NSNumber numberWithBool:NO], OpenFeintSettingEnablePushNotifications,
[NSNumber numberWithBool:YES], OpenFeintSettingAlwaysAskForApprovalInDebug,
[NSNumber numberWithBool:YES], OpenFeintSettingDisableUserGeneratedContent, nil];
[OpenFeint initializeWithProductKey:#"PRODUCTKEY" andSecret:#"SECRET"
andDisplayName:#"NAME" andSettings:settings andDelegates: [OFDelegatesContainer containerWithOpenFeintDelegate:self]];
[[CCDirector sharedDirector] runWithScene: [MainMenuScene node]];

I've seen your post in a few places as I was having the same problem as you were. I just figured out a potential solution for you and thought I would reply. It seems that on some occasions OpenFeint is unable to access the keywindow and in that case creates it's own window that may not act as yours has been set up to do. The solution is to let OpenFeint know specifically which window to go after by adding it to the settings. My settings are below and as you can see I added the "OpenFeintSettingPresentationWindow" Setting with my keyed window. After doing this it worked wonderfully. Hope this helps!
NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight], OpenFeintSettingDashboardOrientation,
window, OpenFeintSettingPresentationWindow,
#"ComingSoon", OpenFeintSettingShortDisplayName,
[NSNumber numberWithBool:YES], OpenFeintSettingEnablePushNotifications,
nil];

Chances are you have the wrong settings bundle for orientations in your binary, delete landscape and add the iPhone universal settings bundle.

I'm not sure specifically what the problem is, but it looks like OpenFeint is trying to display in landscape but is somehow being rotated as if it was in Portrait mode. Can oyu double check to make sure your orientations are correct for both your app's primary view controller (or however you configure it in Cocos2D). And that OpenFeint is aware of it as well?

In cocos2d,the window just need to refer to the window in applicationDidFinishLaunching.

Related

Sharing option with iOS app?

i want to share app info on social network with all social networking application that are previously installed in device. i have one demo images just like this, if any idea please give me.
Thanks in advance
Using UIActivityViewController you can Share, apple doc
Example:
UIImage *anImage = [UIImage imageNamed:#"SampleImg.png"];
NSArray *Items = [NSArray arrayWithObjects:
#"your app info",
anImage, nil];
UIActivityViewController *ActivityView =
[[UIActivityViewController alloc]
initWithActivityItems:Items applicationActivities:nil];
[self presentViewController:ActivityView animated:YES completion:nil];
Here’s a UI control called REActivityViewController from Roman Efimov that looks like a UIActivity view, but allows for full color icons, total customization, and the control works with iOS 5.0. The control looks and works as expected on iPhone and iPad.
This is not simply a control that looks like UIActivityController, but also makes it much easier to create custom activities.
Here’s an example from the readme showing how easy it is to create a custom activity controller:
REActivity *customActivity = [[REActivity alloc] initWithTitle:#"Custom"
image:[UIImage
imageNamed:#"REActivityViewController.bundle/Icon_Custom"]
actionBlock:^(REActivity *activity, REActivityViewController *activityViewController){
{
[activityViewController dismissViewControllerAnimated:YES completion:^{NSLog(#"Hey, there!");}
];
}];
Try this.Happy coding.

Checking if Bluetooth is Disabled on iOS 5 without BluetoothManager

I have seen that in iOS 5, CoreBluetooth provides the capability to check if Bluetooth is disabled. From what I have seen of the documentation, it is clearly aimed at bluetooth peripheral use. However, I am attempting to check if bluetooth is on because I am using GameKit (GKPeerPickerController) that will search endlessly for bluetooth connections if it is not enabled, which is an issue.
I tried to do this like so:
CBCentralManager * manager = [[CBCentralManager alloc] init];
if (manager.state == CBCentralManagerStatePoweredOn ) {
//go ahead with GameKit
}
This does not work, and manager.state is always equal to null. What am I doing wrong here? Or alternatively, are there better ways to check the status of bluetooth on the iPhone?
EDIT: I don't want to call any private APIs because I will be submitting this app to the app store. I have edited my question title to clarify this.
Ok, I discovered that by doing this:
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:FALSE], CBCentralManagerScanOptionAllowDuplicatesKey, nil];
NSMutableArray * discoveredPeripherals = [NSMutableArray new];
CBCentralManager * manager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
[manager scanForPeripheralsWithServices:discoveredPeripherals options:options];
[manager stopScan];
If bluetooth is off, the system will pop up an alert view which will offer the choice to turn bluetooth on. Otherwise, if it finds a peripheral it will call a corresponding delegate method, but if there is nothing in that implementation you don't need to worry about it.
You can find the answer of your question by this link. Check it out.
Edited
Have you checked out the Game Kit Framework reference?
According to Apple:
Game Kit offers your applications the ability to create Bluetooth
connections between two devices.
Edited
Then try this project. https://github.com/sergiomtzlosa/MultiContactsSelector-ios

iOS: Displaying currently played track info in LockScreen?

As of iOS 5 we have access to MPNowPlayingInfoCenter to display info in the lockscreen and in the multimedia controls on the multitasking bar. I have an app that plays local audio files. I want to display info like the artist's name, the album and the artwork on the lockscreen with MPNowPlayingInfoCenter, but the only way to do this (As far as I know) is to use MPMusicPlayerController and get nowPlayingItem... The problem is that MPMusicPlayerController is used to play iPod Music only, and not locally stored files. Is there a way around this in iOS 5?
You can create your own NSDictionary and supply that to the MPNowPlayingInfoCenter.
NSArray *keys = [NSArray arrayWithObjects:MPMediaItemPropertyAlbumTitle, MPMediaItemPropertyArtist, ..., nil];
NSArray *values = [NSArray arrayWithObjects:#"Album", #"Artist", ..., nil];
NSDictionary *mediaInfo = [NSDictionary dictionaryWithObjects:values forKeys:keys];
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:mediaInfo];

OpenFeint Notifications from the bottom

I have both game center and open feint integrated into my app. When the notification comes up to tell you that you successfully logged in, the open feint overlaps the game center notification. How do you move the notification to the bottom instead. I saw the documentation but I can't for the life of me figure out how to get it to work. I see the enum ENotificationPosition and it includes ENotificationPosition_BOTTOM but where am I supposed to put that code to make it work.
All you need to do is specify this in the settings dictionary that you use to initialize OpenFeint. For example,
NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:UIInterfaceOrientationPortrait], OpenFeintSettingDashboardOrientation,
kShortAppName, OpenFeintSettingShortDisplayName,
[NSNumber numberWithBool:NO], OpenFeintSettingAlwaysAskForApprovalInDebug,
[NSNumber numberWithBool:YES], OpenFeintSettingGameCenterEnabled,
window, OpenFeintSettingPresentationWindow,
[NSNumber numberWithInt:ENotificationPosition.ENotificationPosition_BOTTOM_LEFT], OpenFeintSettingNotificationPosition,
nil];
[OpenFeint initializeWithProductKey:kOFProductKey
andSecret:kOFProductSecret
andDisplayName:kLongAppName
andSettings:settings
andDelegates:delegates];

iPhone Facebook app: Finding out where the error is?

So I just added Facebook to a previous app that was working. And I basically just included the code for a button press to upload/post the picture selected to Facebook -- nothing happened.
Are there any good resources for learning the syntax for iOS Facebook apps? Because I'm lost. Also, could you tell me why this seemingly simple code doesn't work? Because I pretty much copied it from the demo app example.
- (IBAction) sendPressed:(UIButton *)sender
{
for(UIViewController *controller in self.tabBarController.viewControllers)
{
if([controller isKindOfClass:[FirstViewController class]])
{
FirstViewController *firstViewController = (FirstViewController *)controller;
[firstViewController realLabel];
}
}
Facebook *facebook = [[Facebook alloc] initWithAppId:#"198223696897308"];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
image, #"picture",
nil];
[facebook requestWithGraphPath:#"me/photos"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
self.tabBarController.selectedIndex = 0;//switch over to the first view to see if it worked
}
The first thing I'd do is verify that the method is actually being called by setting a breakpoint or outputting a log statement.
The second thing I'd do is look at the API documentation to see if any of the methods I'm calling provide errors in any way. They almost certainly do, so check what they say.
The third thing I'd do is set the device to use a proxy (e.g. Charles) to see if the requests are actually being sent out over the wire.