Play sound without disabling ipod playback

#import <AVFoundation/AVAudioSession.h>
#import <AudioToolbox/AudioToolbox.h>

// Set the AVAudio Session property
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryPlayback error:nil];
OSStatus propertySetError = 0;
UInt32 allowMixing = true;
propertySetError = AudioSessionSetProperty (
      kAudioSessionProperty_OverrideCategoryMixWithOthers,
      sizeof (allowMixing),
      &allowMixing
);
NSError *activationError = nil;
[session setActive:YES error:&activationError];
// Now play the sound in filePath
NSURL *fileUrl = [NSURL fileURLWithPath:filePath];
NSError *error;
AVAudioPlayer *player = [[[AVAudioPlayer alloc] initWithContentsOfURL:fileUrl error:&;error]autorelease];

Number of days in the current month

NSDate *today = [NSDate date]; //Get a date object for today's date
NSCalendar *c = [NSCalendar currentCalendar];
NSRange days = [c rangeOfUnit:NSDayCalendarUnit 
                       inUnit:NSMonthCalendarUnit 
                      forDate:today];

NSLog(@"number of days: %d",  days.length);

Detect iPhone 4 inch

#define isPhone568 ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 568)
#define iPhone568ImageNamed(image) (isPhone568 ? [NSString stringWithFormat:@"%@-568h.%@", [image stringByDeletingPathExtension], [image pathExtension]] : image)
#define iPhone568Image(image) ([UIImage imageNamed:iPhone568ImageNamed(image)])

UIImage *image = [UIImage imageNamed:iPhone568ImageNamed(@"Default.png")];

Detect Retina Display

#define IS_RETINA ([[UIScreen mainScreen] respondsToSelector:@selector(displayLinkWithTarget:selector:)] && ([UIScreen mainScreen].scale == 2.0))

if(IS_RETINA)
{
   // Retina display
} else {
  // non-Retina display

}