Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-24-2010, 03:55 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 21
anandkumar.golla is on a distinguished road
Default how to attach audio recorded file to email

Hi all,
i wrote the below code to record audio in my app. Now i need to attach this audio file to email. Please help me...

NSMutableDictionary* recordSetting = [[NSMutableDictionary alloc] init];
[recordSetting setValue :[NSNumber numberWithInt:kAudioFormatAppleIMA4] forKey:AVFormatIDKey];
[recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey];
[recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];

recordedTmpFile = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent: [NSString stringWithFormat: @"%.0f.%@", [NSDate timeIntervalSinceReferenceDate] * 1000.0, @"caf"]]];
NSLog(@"Using File called: %@",recordedTmpFile);

recorder = [[ AVAudioRecorder alloc] initWithURL:recordedTmpFile settings:recordSetting error:&error];

[recorder setDelegate:self];

[recorder record];


Thanks in advance,

Anand Kumar Golla
YQLabs
anandkumar.golla is offline   Reply With Quote
Old 09-11-2010, 03:16 PM   #2 (permalink)
Beast Mode
 
Join Date: Dec 2008
Age: 21
Posts: 1,971
Bertrand21 is on a distinguished road
Default

Quote:
Originally Posted by anandkumar.golla View Post
Hi all,
i wrote the below code to record audio in my app. Now i need to attach this audio file to email. Please help me...

NSMutableDictionary* recordSetting = [[NSMutableDictionary alloc] init];
[recordSetting setValue :[NSNumber numberWithInt:kAudioFormatAppleIMA4] forKey:AVFormatIDKey];
[recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey];
[recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];

recordedTmpFile = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent: [NSString stringWithFormat: @"%.0f.%@", [NSDate timeIntervalSinceReferenceDate] * 1000.0, @"caf"]]];
NSLog(@"Using File called: %@",recordedTmpFile);

recorder = [[ AVAudioRecorder alloc] initWithURL:recordedTmpFile settings:recordSetting error:&error];

[recorder setDelegate:self];

[recorder record];


Thanks in advance,

Anand Kumar Golla
YQLabs
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDire ctory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filepath = [documentsDirectory stringByAppendingPathComponent:memo.memoUrl];

NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filepath];
NSData *dataToSend = [[NSData alloc] initWithContentsOfURL:fileURL];
[fileURL release];

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;

[picker setSubject:@"Recording"];

// Set up recipients
NSArray *toRecipients = nil;
NSArray *ccRecipients = nil;
NSArray *bccRecipients = nil;

[picker setToRecipients:toRecipients];
[picker setCcRecipients:ccRecipients];
[picker setBccRecipients:bccRecipients];

[picker setMessageBody:@"" isHTML:YES];
[picker addAttachmentData:dataToSend mimeType:@"audio/x-caf" fileName:[NSString stringWithFormat:@"voice-memo.caf", memo.memoName]];
__________________
Haters gonna Hate
Likers gonna Like
Bertrand21 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 342
7 members and 335 guests
dre, freewind, hain, HemiMG, lendo, Newbie123, PlutoPrime
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,894
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:58 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0