Skip to main content

Percent Escape the reserved Characters in URI

URI encoding need to be done when performing network API calls based on RFC 3986. In order to encode any character, the following native method can be used:

[uriString stringByAddingPercentEncodingWithAllowedCharacters:
[NSCharacterSet URLQueryAllowedCharacterSet]]


But the above method is not compliant with RFC3986 and it does not encode the reserved characters like "!*'();:@&=+$,/?%#[]". Hence, the following method can be used for percent encoding the specific reserved characters.

((NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL, (__bridge CFStringRef) string, NULL, CFSTR("!*'();:@&=+$,/?%#[]"), encoding)));

}

Comments

Popular posts from this blog

Container View - Multiple View Controllers

       By default, Each Container View can have one child view controller only. Only one controller can be added to container using "Embed segue".       In order to add multiple view controller,  the following may help:      Use a separate container view controller and add it using embed segue to the container view. Now from the container view controller that is created, perform transition to different child view controllers using custom segues.

#iOS8 #XCode6 #SizeClasses

       In Xcode 6, new feature called "Size classes" have been introduced. The size classes are used for making the storyboard compatible for all iOS Devices(iPhone & iPad, even iPod) in both portrait as well as Landscape orientations. To set the size class: 1) Choose "Universal" option while creating the project. 2) Check the auto layout checkbox in Main.storyboard -> File Inspector -> "Use Auto Layout" 3) Check the size classes check box in Main.storyboard -> File Inspector -> "Use Size Classes". There are two types of size classes: Regular and Compact. Hence the different configurations(screen sizes) include, 1) wAny hAny - Base configuration 2) wCompact hRegular - iPhone Portrait 3) wCompact hCompact - iPhone Landscape 4) wRegular wAny - iPad Landscape and portrait On selecting the base configuration, the storyboard works the same in all devices. This can be viewed in "preview" option in the assis

Unity Upgrade 2017.2 and above

Hello  Unity Developers , Recently, I faced few issues with Unity Editor and I hope sharing it will help. What was I trying to do? Scenario? Upgrading to Unity 2017.2 & Unity 2017.3 I was trying to upgrade one of my project from Unity 2017.1.2 version to Unity 2017.2.1f1. On doing so, usually unity automatically updates the obsolete scripts to support new APIs. Once it got updated, I tried to play the game in editor and it worked. Then, what was the problem? While building the project to UWP application, there were some compile errors where Unity.VR need to be updated to Unity.XR. I fixed those errors, quit unity and tried building again.  Wait, Why did I quit Unity and then built it again? Its because unity has this weird issue, when there are compiler errors. Though I had fixed the errors, on building it again, the errors will not go away. We have to quit unity and then build it, TADA, the error will go away. Now coming back to other issues I fa