Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • URL encoding in ios

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 368
    Comment on it

    Hello all,
    I was facing problem with loading URL in UIWebVIew because of wrong encoding method.
    After that I tried this code. It helped me.

    - (NSString*)encodeURL:(NSString *)string
    {
        NSString *newString = NSMakeCollectable([(NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, CFSTR(":/?#[]@!$ &'()*+,;=\"<>%{}|\\^~`"), CFStringConvertNSStringEncodingToEncoding([self stringEncoding])) autorelease]);
        if (newString) {
            return newString;
        }
        return @"";
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: