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

View Single Post
Old 07-29-2010, 08:11 AM   #11 (permalink)
camiech
Registered Member
 
Join Date: Jul 2010
Posts: 2
camiech is on a distinguished road
Default HELP HERE!!

Maybe someone is able to help me.

I am trying to do the same. attach string to an email from iphone app.

The part of facebook and twitter is already working fine...but i havent been able to do it in the part of message.

thanks for your help! i really appreciate it...

I attach first the email part, and then bellow the twitter code...(maybe it is usefull for you).

email part:
-----------
-(IBAction)send:(id)sender
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Check this!"];


// Attach an image to the email
NSString *path = [[NSBundle mainBundle] pathForResource:@"Default" ofType:@"png"];
NSData *myData = [NSData dataWithContentsOfFile:path];
[picker addAttachmentData:myData mimeType:@"image/png" fileName:@"Default"];


// Fill out the email body text
NSString *emailBody = [NSString stringWithString:[webView stringByEvaluatingJavaScriptFromString:@"document. documentElement.innerHTML"]];

[picker setMessageBody:emailBody isHTML:NO];

[self presentModalViewController:picker animated:YES];
[picker release];
}
// Dismisses the email composition interface when users tap Cancel or Send. Proceeds to update the message field with the result of the operation.
- (void)mailComposeController:(MFMailComposeViewCont roller*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
webView.hidden = NO;

[self dismissModalViewControllerAnimated:YES];
}

----------


twitter part:

-(IBAction)twitStatus:(id)sender
{
NSString *content=[NSString stringWithString:[webView stringByEvaluatingJavaScriptFromString:@"document. documentElement.innerHTML"]];
NSRange data=[content rangeOfString:@"</font></center>"];
NSString *author=[content substringToIndex:data.location];
data=[author rangeOfString:@"<br></i>"];
author=[author substringFromIndex:data.location+8];

NSRange data2=[content rangeOfString:@"<br></i>"];
NSString *phrase = [content substringToIndex:data2.location];
data2=[phrase rangeOfString:@"<i><br>"];
phrase=[phrase substringFromIndex:data2.location+7];

phrase=[NSString stringWithFormat:@"%@ - %@",phrase,author ];
[[TwitterAgent defaultAgent] twit:phrase];
}
-----
camiech is offline   Reply With Quote
 

» Advertisements
» Online Users: 359
13 members and 346 guests
AlanR917, AyClass, blakeart113, Domele, esoteric, ilmman, ipodphone, Kirkout, martianflash, Newbie123, Objective Zero, olivia325, Sesio
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,566
Threads: 94,081
Posts: 402,751
Top Poster: BrianSlick (7,990)
Welcome to our newest member, blakeart113
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:11 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.