Skip to content

Commit

Permalink
[attributedlabel] Address deprecations in the NSURLUtilities category.
Browse files Browse the repository at this point in the history
Update NIAttributedLabel to use NIStringByAddingPercentEscapesForURLParameterString instead of -[NSString stringByAddingPercentEscapesUsingEncoding:].
  • Loading branch information
stephanemoore committed Apr 5, 2016
1 parent e13f459 commit a4220ec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/attributedlabel/src/NIAttributedLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,12 @@ - (void)actionSheet:(UIActionSheet*)actionSheet clickedButtonAtIndex:(NSInteger)
} else if (NSTextCheckingTypeAddress == self.actionSheetLink.resultType) {
NSString* address = [self.mutableAttributedString.string substringWithRange:self.actionSheetLink.range];
if (buttonIndex == 0) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[[@"http://maps.google.com/maps?q=" stringByAppendingString:address] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
NSString *escapedAddress =
NIStringByAddingPercentEscapesForURLParameterString(address);
NSString *URLString =
[NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", escapedAddress];
NSURL *URL = [NSURL URLWithString:URLString];
[[UIApplication sharedApplication] openURL:URL];

} else if (buttonIndex == 1) {
[[UIPasteboard generalPasteboard] setString:address];
Expand Down

0 comments on commit a4220ec

Please sign in to comment.