<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Objective-C on Sylvia Mirecki</title>
    <link>http://elijah.mirecki.com/categories/objective-c/</link>
    <description>Recent content in Objective-C on Sylvia Mirecki</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 24 Dec 2013 18:56:51 +0000</lastBuildDate>
    <atom:link href="http://elijah.mirecki.com/categories/objective-c/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Objective-C long URL parameter encoding</title>
      <link>http://elijah.mirecki.com/blog/36/</link>
      <pubDate>Tue, 24 Dec 2013 18:56:51 +0000</pubDate>
      <guid>http://elijah.mirecki.com/blog/36/</guid>
      <description>I was looking for a simple way to build URL&amp;rsquo;s with long parameter lists. There were two problems that I ran into:&#xA;The CFURLCreateStringByAddingPercentEscapes method apparently isn&amp;rsquo;t completely fool proof.&#xA;[NSString stringWithFormat] gets messy with a lot of parameters.&#xA;So I created a class to trivialize the handling of this circumstance.&#xA;#import &amp;lt;Foundation/Foundation.h&amp;gt; @interface UrlParameterBuilder : NSObject { NSMutableDictionary* parameters; } -(UrlParameterBuilder*)init; -(UrlParameterBuilder*)initWithParameterDictionary:(NSDictionary*)parameterDictionary; -(void)addParamWithTitle:(NSString*)title andValue:(NSString*)value; -(NSString*)getUrlString; @end #import &amp;#34;URLParameterBuilder.h&amp;#34; @implementation UrlParameterBuilder -(UrlParameterBuilder*)init { self = [super init]; parameters = [NSMutableDictionary dictionary]; return self; } -(UrlParameterBuilder*)initWithParameterDictionary:(NSDictionary*)parameterDictionary { self = [super init]; parameters = [NSMutableDictionary dictionaryWithDictionary:parameterDictionary]; return self; } -(void)addParamWithTitle:(NSString*)title andValue:(NSString*)value { [parameters setObject:value forKey:title]; } -(NSString*)getUrlString { NSMutableString* result = [NSMutableString string]; BOOL firstIterationComplete = NO; for (NSString* key in parameters) { [result appendFormat:@&amp;#34;%c%@=%@&amp;#34;, firstIterationComplete ?</description>
    </item>
  </channel>
</rss>
