0

"&" を含む 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
4

2 に答える 2

0
        CFStringRef escaped = 
        CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
                                                (CFStringRef)theURL,
                                                NULL,
                                                (CFStringRef)@"!*'();:@&=+$,/?%#[]",
                                                kCFStringEncodingUTF8);

                    NSString* useit = (NSString*)escaped;

CGStringRefをリリースすることを忘れないでください

于 2012-04-23T08:59:32.320 に答える
0

これを試してください:アプリの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];
}
于 2012-04-23T08:55:04.437 に答える