correctly seperate args in url

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

View file

@ -30,13 +30,14 @@
if (!url) return NO;
if ([[url scheme] isEqualToString:@"zxing"]) {
if ([[url host] isEqualToString:@"scan"]) {
NSArray *pairs = [[url query] componentsSeparatedByString:@"&"];
NSArray *pairs = [[url query] componentsSeparatedByString:@"&"];
for (NSString *pair in pairs) {
NSArray *elements = [pair componentsSeparatedByString:@"="];
NSString *key = [[elements objectAtIndex:0] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *val = [[elements objectAtIndex:1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
// NSLog(@"%@ => %@\n", key, val);
if ([key isEqualToString:@"ret"]) {
[[NSUserDefaults standardUserDefaults] setObject:val forKey:@"returnURL"];
[[NSUserDefaults standardUserDefaults] synchronize];