2012년 2월 16일 목요일

iOS How to get current app version

[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]
will return current your app version.

ex)
NSLog([NSString stringWithFormat:@"Version %@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]);

How can my iphone app detect its own version number?

2012년 2월 5일 일요일

iOS Play Sound Effects

1. AudioServicesPlaySystemSound : Cannot control sound volume
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:path ofType:@"wav"]];

if( soundID[index] == -1 )
AudioServicesCreateSystemSoundID((CFURLRef)url, &soundID[index]);

AudioServicesPlaySystemSound(soundID[index]);
2. AVAudioPlayer : Cannot use iPod/iPhone native music player
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:path ofType:@"wav"]];

NSError *error;

AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
[player play];
3. CocosDenshion : With configure mode param, can use iPod/iPhone native music player and control sound volume
// initialize
[CDAudioManager configure:kAMM_FxOnly];

NSString *effect = [[NSBundle mainBundle] pathForResource:path ofType:@"wav"];

if( soundID[index] == -1 )
{
[[SimpleAudioEngine sharedEngine] preloadEffect:effect];
soundID[index] = 1;
}

[[SimpleAudioEngine sharedEngine] playEffect:effect];

2012년 2월 2일 목요일

iOS AudioServicesPlaySystemSound Play Sound

1. 필요한 framework
AudioToolbox.framework

2. include header file
#import

3. Create and play sound
// create & play
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((CFURLRef)url, &soundID);
AudioServicesPlaySystemSound(soundID);

4. Release resource
// release
AudioServicesDisposeSystemSoundID(soundID);

2012년 2월 1일 수요일

Android GC줄이기

onMeasure()
onLayout()
onDraw()
dispatchDraw()
onTouchEvent()
dispatchTouchEvent()
getView()
bindView()

메소드 내에서 객체생성을 줄이자

http://goo.gl/OYeuD