integrate openfeint to cocos2d ipad layout - ipad

I integrated successfully openfeint to my app on iPhone/iPod Touch. But the layout is broken on the iPad.
I copy pasted the code from the sample app from openfeint.
- (void) performOpenfeintInitLogic
{
UIViewController * rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:UIInterfaceOrientationPortrait], OpenFeintSettingDashboardOrientation,
#"asdasdasdas", OpenFeintSettingShortDisplayName,
[NSNumber numberWithBool:YES], OpenFeintSettingEnablePushNotifications,
[NSNumber numberWithBool:NO], OpenFeintSettingDisableUserGeneratedContent,
[NSNumber numberWithBool:NO], OpenFeintSettingAlwaysAskForApprovalInDebug,
#ifdef DEBUG
[NSNumber numberWithInt:OFDevelopmentMode_DEVELOPMENT], OpenFeintSettingDevelopmentMode,
#else
[NSNumber numberWithInt:OFDevelopmentMode_RELEASE], OpenFeintSettingDevelopmentMode,
#endif
window, OpenFeintSettingPresentationWindow,
#ifdef DEBUG
[NSNumber numberWithInt:OFDevelopmentMode_DEVELOPMENT], OpenFeintSettingDevelopmentMode,
#else
[NSNumber numberWithInt:OFDevelopmentMode_RELEASE], OpenFeintSettingDevelopmentMode,
#endif
nil
];
[OpenFeint initializeWithProductKey:#"hgghf"
andSecret:#"nbvnb"
andDisplayName:#"ncvnv"
andSettings:settings
andDelegates:nil];
[OpenFeint launchDashboard];
OFGameFeedView * gameFeed = [OFGameFeedView gameFeedView];
[rootVC.view addSubview:gameFeed];
}
Here the broken layout

Its running now with this configuration. The error was a wrong bundle. This is the right one: OFResources_Universal.bundle.
The config is now:
UIViewController * rootVC = [UIApplication sharedApplication].keyWindow.window.rootViewController;
NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight], OpenFeintSettingDashboardOrientation,
#"asdasdads", OpenFeintSettingShortDisplayName,
[NSNumber numberWithBool:YES], OpenFeintSettingGameCenterEnabled,
[NSNumber numberWithBool:YES], OpenFeintSettingEnablePushNotifications,
[NSNumber numberWithBool:NO], OpenFeintSettingDisableUserGeneratedContent,
[NSNumber numberWithBool:NO], OpenFeintSettingAlwaysAskForApprovalInDebug,
#ifdef DEBUG
[NSNumber numberWithInt:OFDevelopmentMode_DEVELOPMENT], OpenFeintSettingDevelopmentMode,
#else
[NSNumber numberWithInt:OFDevelopmentMode_RELEASE], OpenFeintSettingDevelopmentMode,
#endif
rootVC, OpenFeintSettingPresentationWindow,
#ifdef DEBUG
[NSNumber numberWithInt:OFDevelopmentMode_DEVELOPMENT], OpenFeintSettingDevelopmentMode,
#else
[NSNumber numberWithInt:OFDevelopmentMode_RELEASE], OpenFeintSettingDevelopmentMode,
#endif
nil
];
[OpenFeint initializeWithProductKey:#"asdasdas"
andSecret:#"asdasdasd"
andDisplayName:#"asdasdsad"
andSettings:settings
andDelegates:nil];

Related

AVAssetWriterInput does not currently support AVVideoScalingModeFit - IOS Error

I'm attempting to use the AVAssetWriterInput to crop a video that I read in a screencast of my application. Here is my current configuration.
NSDictionary *videoCleanApertureSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:320], AVVideoCleanApertureWidthKey,
[NSNumber numberWithInt:480], AVVideoCleanApertureHeightKey,
[NSNumber numberWithInt:10], AVVideoCleanApertureHorizontalOffsetKey,
[NSNumber numberWithInt:10], AVVideoCleanApertureVerticalOffsetKey,
nil];
NSDictionary *videoAspectRatioSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:3], AVVideoPixelAspectRatioHorizontalSpacingKey,
[NSNumber numberWithInt:3],AVVideoPixelAspectRatioVerticalSpacingKey,
nil];
NSDictionary *codecSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:960000], AVVideoAverageBitRateKey,
[NSNumber numberWithInt:1],AVVideoMaxKeyFrameIntervalKey,
videoCleanApertureSettings, AVVideoCleanApertureKey,
videoAspectRatioSettings, AVVideoPixelAspectRatioKey,
AVVideoProfileLevelH264BaselineAutoLevel, AVVideoProfileLevelKey,
nil];
NSDictionary *videoSettings = #{AVVideoCodecKey:AVVideoCodecH264,
AVVideoCompressionPropertiesKey:codecSettings,
AVVideoScalingModeKey:AVVideoScalingModeResizeAspectFill,
AVVideoWidthKey:[NSNumber numberWithInt:320],
AVVideoHeightKey:[NSNumber numberWithInt:480]};
_videoWriterInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:videoSettings];
I'm receiving the following error: "AVAssetWriterInput does not currently support AVVideoScalingModeFit"
This is a common error for anyone using this library, but I can't find the actual solution to it. I just see people saying: "I figured it out eventually" without explaining it. The problem is definitely related to this line: "AVVideoScalingModeKey:AVVideoScalingModeResizeAspectFill," which tells the AVAssetWriter to crop the video and maintain the aspect ratio. Anyone know the solution to this?
There is no "solution to it" per se. It's simply unsupported. You'll need to scale the video frames yourself using Core Image or a VTPixelTransferSession or whatever is appropriate for your pipeline.

AVRecorder can't set bit depth

I'm trying to control the bit depth of a .m4a file recorded with AVRecorder :
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat: 44100.0], AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey,
[NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
[NSNumber numberWithInt: 8], AVEncoderBitDepthHintKey,
nil];
But AVEncoderBitDepthHintKey has no effect, same for AVEncoderAudioQualityKey.
It seems that iOS7 and 8 have different defaults : iOS7 always gives a s16p format (according to ffmpeg) and iOS8 a s32p.
I don't want to use any other format than AppleLossless.
I don't think AVEncoderAudioQualityKey is applicable to kAudioFormatAppleLossless and AVEncoderBitDepthHintKey is only a hint.
Maybe you'd have more luck getting 8bit audio in ALAC via the lower level CoreAudio AudioConverter API.

Audio which is recorded in iOS programmatically could not be playable in Windows

Scenario: The App which I am working on I am suppose to recored voice memos and send them to the Windows client. Recording audio in iOS is not that much hard but the recorded file (in my case in the form of .mp3) could not be playable in Windows but the same file could be easily playable in Mac.
I strongly suspect on my audio recording settings which I am using in the following code,
_audioRecorder = [[AVAudioRecorder alloc] initWithURL:audioFileURL settings:_recordingSettings error:&error];
and the settings that I am using is,
_recordingSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:kAudioFormatMPEG4AAC], AVFormatIDKey,
[NSNumber numberWithInt:AVAudioQualityMin], AVEncoderAudioQualityKey,
[NSNumber numberWithInt:16], AVEncoderBitRateKey,
[NSNumber numberWithInt: 2], AVNumberOfChannelsKey,
[NSNumber numberWithFloat:44100.0], AVSampleRateKey,
nil];
I have already tried the various AVFormatIDKeys such as
kAudioFormatLinearPCM - .lpcm
kAudioFormatMPEG4AAC - .acc
kAudioFormatMPEGLayer3 - .mp3
but no gain.
I appreciate any help. In case if it is not possible I need the explanation why!
After some random tries I have managed myself with the settings,
_recordingSettings = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kAudioFormatLinearPCM],AVFormatIDKey,
[NSNumber numberWithInt:16],AVLinearPCMBitDepthKey,
[NSNumber numberWithBool:NO],AVLinearPCMIsBigEndianKey,
[NSNumber numberWithBool:NO],AVLinearPCMIsFloatKey,
[NSNumber numberWithBool:NO],AVLinearPCMIsNonInterleaved,
[NSNumber numberWithInt:AVAudioQualityMin], AVEncoderAudioQualityKey,
[NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
[NSNumber numberWithFloat:2000.0], AVSampleRateKey,
nil];
Important: The filename should be "someName.wav"

argument to 'NSDictionary' method 'dictionaryWithObjectsAndKeys:' should be an objective-C pointer type, not int

-(NSMutableArray*)getLSBGoalList
{
int userId = [[[AppManager sharedAppManager].userInfo objectForKey:USER_ID] intValue];
NSString *query = [NSString stringWithFormat:#"SELECT * FROM tblLBGoal WHERE userId = %d ORDER BY groupId", userId];
FMResultSet *rs = [database executeQuery:query];
NSMutableArray *arrLSBGoals = [NSMutableArray array];
while([rs next])
{
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:[rs intForColumn:#"lbGoalId"]], #"lbGoalId",
[NSNumber numberWithInt:[rs intForColumn:#"groupId"]], #"groupId",
[NSNumber numberWithInt:[rs intForColumn:#"userId"]], #"userId",
[rs stringForColumn:#"uuid"],#"uuid",
[NSNumber numberWithInt:[rs intForColumn:#"dataSyncType"]], #"dataSyncType",
[NSNumber numberWithInt:[rs intForColumn:#"idealValue"]], #"idealValue",
[NSNumber numberWithInt:[rs intForColumn:#"targetValue"]], #"targetValue",nil,
[NSNumber numberWithInt:[rs intForColumn:#"isTargetSet"]], #"isTargetSet",nil];
[arrLSBGoals addObject:dict];
}
return arrLSBGoals;
}
I am using the above code and when I analyse my project I got a warning, Argument to 'NSDictionary' method 'dictionaryWithObjectsAndKeys:' should be an objective-C pointer type, not int. Analyser show me the below way to fix it but I can't understand what to do. Can anybody please help me.
You have an extra nil in the line before last:
[NSNumber numberWithInt:[rs intForColumn:#"targetValue"]], #"targetValue",nil, // here
[NSNumber numberWithInt:[rs intForColumn:#"isTargetSet"]], #"isTargetSet",nil];
using the newer Objective-C dictionary literal syntax is much easier to read and doesn't require a terminating nil:
NSDictionary *dict = #{
#"lbGoalId" : #([rs intForColumn:#"lbGoalId"]),
#"groupId" : #([rs intForColumn:#"groupId"]),
// etc.
};
When creating dictionary you are trying to set nil in between. When I try to execute this I donot face any warning
-(NSMutableArray*)getLSBGoalList
{
// int userId = [[[AppManager sharedAppManager].userInfo objectForKey:USER_ID] intValue];
// NSString *query = [NSString stringWithFormat:#"SELECT * FROM tblLBGoal WHERE userId = %# ORDER BY groupId", #""];
MyClass *rs=self;
NSMutableArray *arrLSBGoals = [NSMutableArray array];
while([rs next])
{
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:[rs intForColumn:#"lbGoalId"]], #"lbGoalId",
[NSNumber numberWithInt:[rs intForColumn:#"groupId"]], #"groupId",
[NSNumber numberWithInt:[rs intForColumn:#"userId"]], #"userId",
[rs stringForColumn:#"uuid"],#"uuid",
[NSNumber numberWithInt:[rs intForColumn:#"dataSyncType"]], #"dataSyncType",
[NSNumber numberWithInt:[rs intForColumn:#"idealValue"]], #"idealValue",
[NSNumber numberWithInt:[rs intForColumn:#"targetValue"]], #"targetValue",
[NSNumber numberWithInt:[rs intForColumn:#"isTargetSet"]], #"isTargetSet",nil];
[arrLSBGoals addObject:dict];
}
return arrLSBGoals;
}
- (BOOL)next{
return YES;
}
- (int)intForColumn:(NSString *)str{
return 0;
}
- (NSString *)stringForColumn:(NSString *)str{
return #"";
}

Error in setting output video settings

output.videoSettings = [NSDictionary dictionaryWithObject:
[NSNumber numberWithInt:kCVPixelFormatType_32BGRA]
forKey:(id)kCVPixelBufferPixelFormatTypeKey];
I get this error on this particular line
No known class method for selector "dictionaryWithObject:forKey:
Any reason for this error?
Try this:
videoOutput.videoSettings = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA], (id)kCVPixelBufferPixelFormatTypeKey,
nil];

Resources