Category : IOS

How to access Camera Roll Albums Programatically

-(void)getAlbumPhotos:(NSString *)albumName { __block BOOL albumWasFound = NO; //search all photo albums in the library [self.library enumerateGroupsWithTypes:ALAssetsGroupAlbum usingBlock:^(ALAssetsGroup *group, BOOL *stop) { if([albumName compare: [group valueForProperty:ALAssetsGroupPropertyName]]==NSOrderedSame) { //target album is found albumWasFound = YES; [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) { ALAssetRepresentation *representation = [result defaultRepresentation]; if(result){ UIImage *latestPhoto = [UIImage imageWithCGImage:[representation fullScreenImage]]; [mutPhotoArray

Read More →

643 total views, 1 views today

How to Extract Audio from a Video File in iOS

-(void)extractAudioFromVideo:(NSURL*)videoSrcPath audioFilePath:(NSString*)dstPath{ AVMutableComposition* newAudioAsset = [AVMutableComposition composition]; AVMutableCompositionTrack* dstCompositionTrack; dstCompositionTrack = [newAudioAsset addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid]; //NSURL *srcURL=[NSURL fileURLWithPath:videoSrcPath]; NSURL *srcURL=videoSrcPath; AVAsset* srcAsset = [AVURLAsset URLAssetWithURL:srcURL options:nil]; AVAssetTrack* srcTrack = [[srcAsset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0]; NSArray *formatDescriptions=srcTrack.formatDescriptions; NSString *fileType = nil; NSString *ex = nil; if ([formatDescriptions count] > 0) { CMAudioFormatDescriptionRef formatDesc=(__bridge CMFormatDescriptionRef)[formatDescriptions objectAtIndex:0]; FourCharCode mediaSubType = CMFormatDescriptionGetMediaSubType(formatDesc);

Read More →

885 total views, 1 views today

iOS Device UDID (Universal Device Identifier) and UUID (Universal Unique Identifier)

UDID stands for Universal Device Identifier which uniquely identify device, a sequence of 40 hexadecimal character length alphabet. Apple has hidden this UDID from iOS 6 for security purpose. It was accessable before iOS6. iOS developers can access below code :- NSString *udid; if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@”6.0″)) udid = [UIDevice currentDevice].identifierForVendor.UUIDString; else udid = [UIDevice currentDevice].uniqueIdentifier; 1

Read More →

2,295 total views, 1 views today

Find out the device iOS version at run time

Apple provide a numerous way to get device iOS version at run time :- 1) Using UIDevice Class float deviceVersion = [[[UIDevice currentDevice] systemVersion] floatValue]; e.g. iOS Version = 6.1 int deviceVersion = [[[UIDevice currentDevice] systemVersion] integerValue]; e.g. iOS Version = 6 2) According to iOS 7 Guideline Document, we can use Foundation Class Predefine

Read More →

545 total views, 1 views today

How to get iOS device type at run time like iPhone, iPod or iPad device

Apple provide following way to find out the Device Type or Model such we can make application Universal or can change or load User Interface according to iPad or iPhone5 or iPhone dynamically. 1) Using UIDevice Class if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad){ //iPad }else{ if ([UIScreen mainScreen].bounds.size.height > 500) { //iPhone5 or iPod5 }else{ //iPhone

Read More →

592 total views, 1 views today

1 2 3 4