Develop				
			
										2014.05.12 16:43				
				[ios] URL 파라미터 파싱~
																																			조회 수 4665										댓글 0									
				
							URL 파라미터 파싱하는..
URLParser.h
@interface URLParser : NSObject @property (nonatomic, retain) NSArray *variables; @property (nonatomic, retain) NSArray *keys; - (id)initWithURLString:(NSString *)url; - (NSString *)valueForVariable:(NSString *)varName; @end
URLParser.m
@implementation URLParser
- (id) initWithURLString:(NSString *)url{
    self = [super init];
    if (self != nil) {
        NSString *string = url;
        NSScanner *scanner = [NSScanner scannerWithString:string];
        [scanner setCharactersToBeSkipped:
            [NSCharacterSet characterSetWithCharactersInString:@"&?"]];
        NSString *tempString;
        NSMutableArray *keys = [NSMutableArray new];
        NSMutableArray *vars = [NSMutableArray new];
        //ignore the beginning of the string and skip to the vars
        [scanner scanUpToString:@"?" intoString:nil];
        while ([scanner scanUpToString:@"&" intoString:&tempString]) {
            [vars addObject:[tempString copy]];
            
            [keys addObject:
                [[tempString componentsSeparatedByString:@"="]
                    objectAtIndex:0]];
        }
        self.variables = vars;
        self.keys = keys;
    }
    return self;
}
- (NSString *)valueForVariable:(NSString *)varName {
    for (NSString *var in self.variables) {
        if ([var length] > [varName length]+1 &&
            [[var substringWithRange:NSMakeRange(0, [varName length]+1)]
                isEqualToString:[varName stringByAppendingString:@"="]])
        {
            NSString *varValue =
                [var substringFromIndex:[varName length]+1];
            return varValue;
        }
    }
    return nil;
}
- (void) dealloc{
    self.variables = nil;
    self.keys = nil;
}
@end- 
	
	
	
[ios] 카테고리 확장 메소드를 찾지 못하는 경우
 - 
	
	
	
[ios] @property의 속성 (strong, weak, copy) 사용 경우
 - 
	
	
	
OCB5 Injection 앗싸뵹! ㅋㅋ
 - 
	
	
	
[ios] TextField 특정 문자만 사용하도록 하기
 - 
	
	
	
[ios] XCode에서 Provisioning Profile 여러개 중복될 때
 - 
	
	
	
알고리즘 성능 분석 기준
 - 
	
	
	
알고리즘 성능분석
 - 
	
	
	
[ios] iOS에서 디바이스 종류 알아오기
 - 
	
	
	
[ios] 아이폰 GPS 사용하기
 - 
	
	
	
[ios] 언어, 지역, 국가 설정 가져오기
 - 
	
	
	
[ios] URL 파라미터 파싱~
 - 
	
	
	
[ios] 앱 딜리게이트 얻어오기. (AppDelegate)