myscheme:?id=test- a valid URL, but NSURLrecognizes it as such, returning not nilfrom +URLWithString:.
However, in RFC 1808, it does not match in such a way that it NSURLrecognizes the character ?as indicating a query string, therefore -queryreturns nil.
, NSURLComponents , ? :
NSURLComponents *components = [NSURLComponents componentsWithString:@"myscheme:?id=test"];
return components.query;
iOS 6 , KSURLComponents, .