NSURL on iOS 7

There's a subtle change in the way URLWithString: works on devices running iOS 7. On iOS 6, spaces at the end of the string used to be percent-encoded and a valid NSURL object was created, but on iOS 7 the method will return nil. For example:

NSURL *urlOne = [NSURL URLWithString:@"http://number23.org"];
NSURL *urlTwo = [NSURL URLWithString:@"http://number23.org "];

iOS6 http://number23.org http://number23.org%20

iOS7  http://number23.org (null)

A non-encoded space inside the string will mean nil is returned on both platforms: it's just this edge-case that is the oddity. Arguably this is actually a bug that has been fixed, and you should be encoding your strings anyway, but it's worth checking your URLs (or running stringByTrimmingCharactersInSet: over them as standard) so you don't get burned by this little beauty.