- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{
NSString *URLString = [[url absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSArray *temp = [URLString componentsSeparatedByString:@"\r\n"];
return YES;}
that does not split the string, though preview shows \r\n are still in the string. Any suggestions?
input URL sample- myapp://bla\r\nbla
here is string after replacing % esc and splitting by '\r\n':
here is url before replacing % esc:
I suspect replacing percent escapes has got to do something with it.
As per Eduardo but closer to your code, the following:
NSString *URLString = @"myapp://bla\r\nbla";
NSArray *temp = [URLString componentsSeparatedByString:@"\r\n"];
NSLog(@"%@", temp);
Outputs:
2014-03-20 12:05:17.247 Untitled 3[437:507] (
"myapp://bla",
bla
)
Is it possible your incoming string contains the literal four-character sequence \r\n, which would be written as @"\\r\\n"
rather than the sequence of two control codes, \r\n?