Skip to content

Commit 0d9f5cc

Browse files
committed
SSYMailto no longer uses the deprecated CFURLCreateStringByAddingPercentEscapes().
1 parent 9f9d3cd commit 0d9f5cc

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

SSYMailto.m

+4-16
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,9 @@ + (void)emailTo:(NSString*)address
99
subject:(NSString*)subject
1010
body:(NSString*)body {
1111
NSString* mailtoString = [NSString stringWithFormat:@"mailto:%@?subject=%@&body=%@",
12-
(NSString*)[(NSString*)CFURLCreateStringByAddingPercentEscapes(
13-
NULL,
14-
(CFStringRef)address,
15-
NULL,
16-
CFSTR("&"),
17-
kCFStringEncodingUTF8) autorelease],
18-
(NSString*)[(NSString*)CFURLCreateStringByAddingPercentEscapes(NULL,
19-
(CFStringRef)subject,
20-
NULL, CFSTR("&"),
21-
kCFStringEncodingUTF8) autorelease],
22-
(NSString*)[(NSString*)CFURLCreateStringByAddingPercentEscapes(NULL,
23-
(CFStringRef)body,
24-
NULL,
25-
CFSTR("&"),
26-
kCFStringEncodingUTF8) autorelease]] ;
12+
[address stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]],
13+
[subject stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]],
14+
[body stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]] ;
2715

2816
// Create an email message in user's default email client
2917
NSURL* mailtoURL = [NSURL URLWithString:mailtoString] ;
@@ -56,4 +44,4 @@ + (void)emailTo:(NSString*)address
5644
}
5745
}
5846

59-
@end
47+
@end

0 commit comments

Comments
 (0)