"&" を含む iPhone アプリから URL をメールで送信する方法。サンプルURLです
http://www.google.co.in/search?hl=en&safe=active&q=facebook&oq=facebook&aq=f&aqi=&aql=&gs_l=mobile-gws-serp.3...0l0l0l1620716l0l0l0l0l0l0l0l0ll0l0.frgbld.&mvs=0
CFStringRef escaped =
CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
(CFStringRef)theURL,
NULL,
(CFStringRef)@"!*'();:@&=+$,/?%#[]",
kCFStringEncodingUTF8);
NSString* useit = (NSString*)escaped;
CGStringRefをリリースすることを忘れないでください
これを試してください:アプリのMFMailComposure iNメール機能で
-(void)displayComposerSheet
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"My URL!"];
// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"xyz@abc.com"];
NSString *emailBody = @"http://www.google.co.in/search?hl=en&safe=active&q=facebook&oq=facebook&aq=f&aqi=&aql=&gs_l=mobile-gws-serp.3...0l0l0l1620716l0l0l0l0l0l0l0l0ll0l0.frgbld.&mvs=0";
[picker setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:picker animated:YES];
[picker release];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
message.hidden = NO;
switch (result)
{
case MFMailComposeResultCancelled:
message.text = @" Message canceled";
break;
case MFMailComposeResultSaved:
message.text = @"Message saved";
break;
case MFMailComposeResultSent:
message.text = @"Message sent";
break;
case MFMailComposeResultFailed:
message.text = @"Message failed";
break;
default:
message.text = @"Message not sent";
break;
}
[self dismissModalViewControllerAnimated:YES];
}