stringByReplacingOccurrencesOfString doesn't do what I thought it did

git-svn-id: https://zxing.googlecode.com/svn/trunk@2630 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
smparkes@smparkes.net 2013-04-06 22:26:16 +00:00
parent 0badbf57ae
commit add451d5bf

View file

@ -116,7 +116,20 @@
[[NSUserDefaults standardUserDefaults] setObject:resultString forKey:@"lastScan"];
NSString *returnUrl = [[NSUserDefaults standardUserDefaults] stringForKey:@"returnURL"];
if (returnUrl != nil) {
NSURL *ourURL = [NSURL URLWithString:[returnUrl stringByReplacingOccurrencesOfString:@"{CODE}" withString:resultString]];
resultString = (NSString*)
CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
(CFStringRef)resultString,
NULL,
(CFStringRef)@"!*'();:@&=+$,/?%#[]",
kCFStringEncodingUTF8);
NSURL *ourURL =
[NSURL URLWithString:[returnUrl stringByReplacingOccurrencesOfString:@"{CODE}" withString:resultString]];
CFRelease(resultString);
// NSLog(@"%@", ourURL);
[[UIApplication sharedApplication] openURL:ourURL];
return;
}